-
Notifications
You must be signed in to change notification settings - Fork 635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Category field: Able to select multiple when limited to only one selection #1847
Comments
The issue is that the modal doesn't know about the field's limits. A similar issue also exists for Assets, Entries, and Users fields, when a limit is set on them - the limit won’t be applied until after a selection has been made. It’s especially complicated for Categories though, since it’s a “Branch Limit” rather than a hard limit on how many individual categories can be selected. |
I tested this with the Entries field (content field) and there the problem does not exist. |
If you have an Entries field with a limit of 5, you will be able to select > 5 in the modal, but only 5 will be selected after you click Select. |
My opinion, since this topic comes up again and again: I understand the idea of a branch limit, but honestly I do not understand, why selecting a third level category actually selects the 2 parents too. Ignoring parents is more difficult than explicitly querying them would be (especially if a category has/d a method for this purpose), in case you need them. With such a logic the branch limit would be the same as a category limit and I guess limiting it could be easier. Just an idea, though a total change of behavior. |
@hiasl This is pretty typical behavior for taxonomies, where sub items inherit from their parents. Given the following taxonomy:
Anything that is categorized as an Apple should always also be categories as a fruit, and also food. If that general logic does not apply to your taxonomy, then you are probably not organizing it correctly. |
You are totally right with your taxonomy, which should exactly be as in your sample. But let's take this one step further. Think about recipes (and please ignore quantities at the moment) and let's organize ingredients via categories. Let's add a second fruit "banana" on the 3rd level. When I organize that in craft and select 2 ingredients (apple, banana), it's totally logical and correct that these are also fruits and food, but it's not important to the use case. The recipe's editor would select the ingredients and when I iterate over the selected ingredients I need to drop out the parent elements manually although neither the editor meant them to appear nor is it important to me, what the parent elements are (I assume this will be the case on most applications). In my case I organize events with "country > city > venue" via categories. Same thing here. Country is an important information, when I filter my events, but the main information is the last (childless) level. What I'm just saying is that I assume that more often you will only need the last level. Or to be more general: There's a need for both. But actually this discussion is drifting off the issues' topic :-) |
Description
When you have a category field and a limit to select only one category for an entry, then it is still possible to select multiple categories (using shift + click or cmd + click or ctrl+click), although only one will actually be used when clicking the button to use the selected categories
Steps to reproduce
Additional info
Step 2 - Selected two categories:
Step 4 - Only the category "PLAY" is used:
The text was updated successfully, but these errors were encountered: