Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jsf : Validation error value is not valid for SelectOneMenu [duplicate]

Tags:

jsf

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.

like image 578
ccp_123 Avatar asked Dec 30 '10 21:12

ccp_123


1 Answers

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.

See also:

  • Validation Error: Value is not valid
like image 58
BalusC Avatar answered Nov 16 '22 07:11

BalusC