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.....
Joined: Oct 08, 2006
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.
Try to change the scope of your managed bean from request to session
The woods are lovely, dark and deep, But I have promises to keep; And miles to go before I sleep, And miles to go before I sleep. - Robert Frost
Joined: Oct 08, 2006
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.