Hide Enumeration Dropdown values on Conditional basis

0
Morning All,   I’ve gone through many of the threads on our Mendix forum but didn’t find the final/best solution.   My requirement is very simple, it is I’ve Entity in which I’ve my enum field with 6 dropdown values. I just want to hide one of its value when my Boolean value is TRUE (which I will turn on/off from my admin page when required).   Please suggest or share any of the mendix thread which you find more suitable (sorry, I did find a lot but do not see a complete solution). Thank you in advance.   Regards, Ramya    
asked
3 answers
1

And there is an widget for that. Check the marketplace DynamicEnumPicker : https://marketplace.mendix.com/link/component/111237

Regards,

Ronald

 

answered
1

Hey there,

You can hide certain values in a dropdown list using CSS very easily; just create and add a class to your dropdown list. In the class, use a selector that looks for the value of the list item you want to block, and then display – none. However, if a user inspects the page, they will be able to undo the ‘display:none;’ setting. Make sure to add a check in your form validation that fails if that value is selected. Then together, this design is robust. Plus, using conditional styling, you can trigger these classes depending on your boolean attribute.
 

Hope this helps, Best regards, Wouter

answered
0

Hi Ramya,

As far as I know this is not possible with the regular dropdown, however there is an alternative you can use.

  1. Create another entity containing an attribute. The attribut will be one of the values in the dropdown.
  2. Create an admin page where you can create/edit/delete the entity you just created. Create one entity for each of the values in the dropdown.
  3. Create an association between the original entity that contained the enumeration and the new entity. 
  4. Now on the page where the dropdown was use a reference selector to set the association. In the reference selector properties you can set the selectable object. Here you can set a microflow which determines what objects are selectabel.

 

Hope this helps!

answered