Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF Validation Error Despite Having My Own Validator  RSS feed

 
Tj Grant
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following in my JSP:



Note that I have my own validator which is getting called.

Despite having my own validator, it appears that JSF is performing some sort of validation on its own because whenever I submit my webpage, I get the following error on the field in question:

Validation Error: Value is not valid

StatusList is an array of SelectItems (i.e. SelectItem[]) which is stored in a session-scoped bean. It is built once when the bean is created.

I have tried immediate=true and immediate=false and get the same results no matter which value I use.

This has been driving me crazy all day. I'm sorry for the simplistic question but I can't figure out why this is happening.

[EDIT] I should mention that we are using JSF 1.1 and Java 6.

Thanks.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, there is an internal validator. The value(s) of a SelectOneListbox or selectManyListbox MUST be values defined in the SelectItem collection. Or null, but null causes a default selection to be made and posted back to the server.
 
Tj Grant
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The values in my selectManyListBox are defined in the SelectItem collection - that is where the values come from. My backing bean provides an array of SelectItem (SelectItem[]) that is used to build the <option> values in the HTML <select> component. This comes from <f:selectItems value="#{bean.statusList}"

The interesting thing is when i select no value in the list box (which is valid as the field is not required), the page works fine. No error is returned from JSF. But when i select any entry (or multiple entries) I get this error.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!