-
Notifications
You must be signed in to change notification settings - Fork 627
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
[4.2.3]: Multiple fields with the same name cause issues with entry filters #11881
Comments
This is working as expected – it would be completely unclear which “Angebotsart” option refers to which field if we showed duplicate option labels. So the condition builder will intentionally filter out any duplicates. To work around this, give each of your fields a unique name. You can then override their labels to each just say “Angebotsart” by editing the fields’ settings within their respective field layouts. |
@brandonkelly Thanks for the explanation! I understand the reasoning behind this feature, though I'm not sure that I agree with the conclusion. Having multiple fields with the same name in the dropdown is confusing, yes, but having fields missing is even more confusing. In this case, our client expected to be able to select from all the five category trees when selecting
We're doing that now, and it's an acceptable solution in many cases. But I would argue there are definitely valid reasons/use-cases to have multiple fields with the same name. Giving the fields different names and overriding that in the field layout is not a good solution in this case, because it will be even more confusing to the client if the field has a different name in the filters dropdown than it does in the entry form. I think a better solution would be to display more information in the filters dropdown (field handle or the entry types the field is used in) to make them uniquely identifiable. Can I open a discussion for that feature request or should I consider this issue firmly closed? 👀 |
@MoritzLost You’re welcome to propose a specific idea of what you’d like to see in a new discussion. But that would be a feature request we’d have to consider down the road. The issue as it stands is firmly closed because it’s working as expected. |
What happened?
Description
The new entry filters (conditionals) seem to have an issue if there are multiple fields with the same name.
A bit of background: We have a section with five entry types. There's one separate category group corresponding to each entry type, and there are five category fields for the five category groups. Each of the five entry types in the section uses the category field linked to the category group it belongs to. For usability reasons, those five fields are all named identically (
Angebotsart
, which means something likeOffer type
in German).Unfortunately, Craft only displays one field with this name in the filters dropdown:
There should be five fields named
Angebotsart
in the dropdown, but there's only one. I assume those fields are somehow collapsed to a single one to improve readability? But this doesn't make sense, because now you can only filter by one of the five category groups, and there's no way to filter by the other category groups.We use the built-in source view for the section and have added five custom sources, one for each of the entry types. This issue occurs in all of those sources. So every custom source that is limited to one entry type only has the field for the first entry type in the section as a filter available. Of course, adding any filter yields zero results for those sources, because the field relating to that group is not used in those entry types.
Steps to reproduce
Expected behavior
I should see all fields in the filters dropdown. In my screenshot above, there should be five fields named
Angebotsart
. Of course this is not ideal, since there's no way to tell which field is which. But that's better than the alternative, not being able to filter by those fields at all.Some additional ideas:
Actual behavior
Having multiple fields with the same name causes the filters dropdown to only show one of them.
Craft CMS version
4.2.3
PHP version
8.1
Operating system and version
No response
Database type and version
MySQL 8
Image driver and version
No response
Installed plugins and versions
No response
The text was updated successfully, but these errors were encountered: