Skip to content

[4.x]: Unable to filter elements by a custom dropdown field that includes an optional/empty option #17000

@kabel

Description

@kabel

What happened?

Description

I have a custom field of type Dropdown that is added as a non-required field to an entry type. The Dropdown has an option that allows for an empty value and a label of "(None)".

Image

After adding this field to an existing entry type, I'd like to use the entries index to quickly find entries that have (a) any non-empty option selected or (b) no option or the empty option selected. Query (a) helps me to see entries that have opted in to this new field without having to manually select all the valid options. Query (b) is the opposite and shows me the entries that still need to opt-in to the new field.

Steps to reproduce

  1. Create a custom field of type "Dropdown"
  2. Add dropdown options:
    • Label: (None); Value:
    • Label: French; Value: fr
    • Label: Italian; Value: it
  3. Add this new field to an entry type as a non-required field
  4. Create or edit and existing entry of the same type, ensuring the new field's dropdown had selected the empty "(None)" option
  5. From the entry index, open the search filter popover
  6. Add a filter for the new field
  7. Focus on the text input next to the "is one of" operator dropdown

Expected behavior

The operator dropdown either includes operators to allow me to filter to only the entries that have the "(None)" option selected or the field has yet to be populated (aka empty).

Image

Actual behavior

Only the "is one of" or "is not one of" operators are available and neither of them allow the inclusion of empty value labeled "(None)".

Image

Craft CMS version

4.14.10

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions