Hi, I am new to JSF and i have a problem with the immediates set to true when set on two components inside my form. I have huge datacapture form which has two dynamic select box and both has attribute required set to true and a corresponding listener.
when i do an onchange of the first select box i have to retrieve it sub elements and show it in another select box and this happens, at the same time only for the second select box which has immediate set to true the validation happens and it throws the error message saying "Field is required" whereas other non-immediate fields doesnt show error.
how to avoid this?
Also after saving the records i am showing a save message in the create screen subsequently if the user doesnt give data for mandatory field and saves, it shows error message "required"(which is correct) but at the same time my save message is also appearing. how to remove the save message when error occurs..I am doing a client side validtion in this case.
This is a extremely annoying shortfall in the JSF specification, making immediate=true fields incompatible with validation. Unfortunately it is 'as per specification'. As a consequence I tend to only use immediate=true if I have no validation, or for cancel buttons.
One thing I have used in place of immediate=true is an Ajax call to refresh the other elements when a list box is selected.
There are many options and frameworks to make the Ajax/JSF call, and have Ajax communicate with your backing bean in a JSF compatible way.
Hope this helps. Bob
Joined: Nov 07, 2006
hi, Thanks for your response. Can you give some samples for integration of JSF and AJAX with backing bean?