Disable part of drop down menu

0
Hi,I have an enum with several values, and I’m displaying them in a dropdown menu. I want to disable some of the values based on a condition. Is this possible?
asked
4 answers
2

This is not possible directly with an enum dropdown. Mendix enum dropdowns do not support disabling individual values dynamically based on conditions.


The recommended workaround is to replace the enum with a reference entity. Create an entity that represents the enum values (for example, StatusOption) and include attributes such as Name and IsSelectable. Then use a Reference Selectorinstead of an enum dropdown and filter the selectable options using an XPath constraint.

answered
1

Ajay Kumar Chinni


Hi Raghavendra,

This is not possible with enums.

We had a similar requirement in the past where we stored all the values in an entity with additional attributes like active/inactive.

Later we used a reference selector on the page and used a xpath to constrain selectable objects with Active flag


answered
0

hi,


No you cannot disable specific enum values in a standard Mendix Drop-down widget.

Enum-based dropdowns always show all values defined in the enumeration. There is no built-in option to disable individual enum entries conditionally.

Correct & Supported Solution

Instead of using an Enum directly:

Use a Reference (Lookup) Entity

  1. Create an entity, e.g. StatusOption
    • Attribute: Name (String or Enum)
    • Attribute: IsActive (Boolean)
  2. Replace the enum attribute with a reference to StatusOption.
  3. In the dropdown:
    • Use Data source = Database
    • Add XPath constraint:

[IsActive = true]

Now you can dynamically control which options appear.

Alternative (If You Must Keep Enum)

You cannot disable values, but you can:

  • Hide the entire dropdown based on condition
  • Or validate in microflow and show error message if restricted value is selected

But you cannot gray-out specific enum entries.

For dynamic enable/disable behavior, never use enum directly.

Use a lookup entity with filtering — that is the clean, scalable solution in Mendix.


answered
0

The options mentioned above can work, but if you make use of the Combobox widget, you can manipulate the selectable values (and also re-order if desired).


General >> Datasource >> Static


You could configure this widget multiple times and then display based on conditional visibility.

answered