I have a selectMenu, with list of (SelectItems) defined in handler as follows
Handler { List(SelectItem) stateList; State state; }
State { String stateCd; }
JSF Code::
<h:selectOneMenu value="#{state.stateCode}">
<f:selectItems value="#{handler.stateList}">
</h:selectOneMenu>
Now my list is in requestScope, and I see submitted value is string and is present in the list but I still get "Validation error: Value is not valid".Can someone assist.
Validation Error: Value is not valid
This means that the selected item does not match any of the items available in the list. I.e., the stateCode.equals(stateList.get(i))
has never returned true
for any of the items.
This can happen when the stateList
is empty during validations phase, or when the equals()
method of the value type is not (properly) implemented.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With