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

Validation Error: Value is not valid  RSS feed

 
Arpitha Pasnoor
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

As per my requirement, I have a Select One box. I need to render the UI components(input texts, select boxes, radio buttons, output texts ...) on selection of drop down value. I have action buttons like close, save etc.
I am using custom converter to validate the form for required value. I am able to validate the fields on click of save button, but the problem is whenever I change the value in Select One box it's throwing Validation Error: Value is not valid, which is not allowing user to perform other actions.

In converter class I have taken a boolean value to do validations only when save is clicked. I have not specified the converter for that select one box. When I have selected for the first time it's not calling the converter class, for second selection it's calling the converter class and throwing the above exception.

please can anybody help me out, I am deadly in need of solution.....

Thanks,
Arpitha
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have really no idea what you're talking about with "select one box". Please don't rephrase components in your own words. This makes no sense.

Let's assume that you're talking about the h:selectOneMenu component. You will get this error during the form submit when the selected item is not part of the selectitems. So basically all you need to do is that the getter of the selectitems returns exactly the same list as it did during display.
 
Sumeet Singh Aryan
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
Try to change the scope of your managed bean from request to session
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A very bad idea. This has much more impact on the code logic and the user experience.

Request scoped data belongs in the request scope. Session scoped data belongs in the session scope. Application scoped data belongs in the application scope. Simple as that. Do not put request scoped data in the session scope. Suggesting to split the list of items into a session or application scoped bean would be a better idea.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!