Disable Dropdown Options Conditionally


This is a simple scenario. On selecting a value from Dropdown (DD_A), some values in DropDown (DD_B) must be disabled.

Both DD_A and DD_B have their values as individual Select Items (Options) and not as Option Group.

I tried the following.

Set the “Disabled” property of the Select Item in DD_B to an expression comparing the value bound to DD_A as below.

#{BlahBlahDefaultviewView.yourVehicle != "EuroFighter"}

This makes that Select Item always Disabled.

I tried to use On Change Client Side script of DD_A to access the child controls (SelectItem) of DropDown Control by hoping to use DOM access methods and


, but I was obviously not doing it right.

BTW, I previously tried to post this message with below code example

#{BlahBlahDefaultviewView.selectedFruit != "appl.e"}

and the Forum promptly displayed the following message without “.” in “appl.e”.

The word appl.e is on our list of spam related words. Please refrain from posting this word.

Hope it is a minor thing and someone can help me with this.

Thank you for your help in advance,
Best regards,

Hi Raj,
your first option should just work fine (provided you refresh the second dropdown DD_B when the value of the first DD_A changes). Could you double check that the value of the options are set to ‘EuroFighter’ and not something different (or a typo)?

best regards


Clearly my brain was frozen yesterday. I had forgotten to refresh DD_B.

There was another complexity to this. The DropDown DD_B itself must be enabled based on the value of another DropDown DD_A2 which was handled on the “on change” event of DD_A2 by using setDisabled(true).

What this did was, it was graying out the values in DD_B but you could still pulldown the list and select a value.

I then used an expression based on Value of DD_A2 to set the Disabled property of DD_B and did a refresh in the JS. This worked.

Thank you,
Best regards,

Ok, I thought that this was resolved until after a few rounds of testing, I ran into the following rather infamous error.

{0}: Validation Error: Value is not valid

I will explain the scenario when this occurs and when it does not.

This happens when I do refresh of the DropDown and hit a form submit button that opens a new window.

If I remove the refresh, then this error does not appear.

A bit of “Googling” said that this is a known JSF feature :? and you have to work around it. From the examples that I saw and also on a very recent post in this forum on the same error (“Enum Dropdown etc…”), all of them have the list populated from the server side. But, what I have is Select Items (Options) and not Option Group.

Is there a way to get around this?

Thank you for your reply,
Best regards,

Hi Raj,
when does the validation error exactly appear? I guess it occurs when the selected value of the dropdown is not among the “selectable” values. If this is the case, you’ll have to add some more logic to prevent this (not a simple thing in your scenario).
best regards


I ran into this error {0}: Validation Error: Value is not valid , and I don’t know how to get rid of this.

The thing is, this error appears at the 3rd time of refreshing a table wherein I have a dropdown.

With my initial investigation I found out that this appears to be some issue when the table is refreshed more than twice. ( here the table is used for taking inputs and has add row button. There’s no issue passing inputs to the backend flow service for the first two times or sometimes one time only).

Now if you have figured out this crazy error, please do help.


Hi, I don’t know if it is useful for you. But I had the same error when I tried to refresh three different controls. I got rid of it when I replaced the refresh of the controls separately by only one control that contained the three.