I was working on the following:
jsf for auto-filling
[A zipcode field is filled by user, the state and city fields are auto-filled(Taking example from JSF 2.0 Complete Reference book)]
In the form, there are four input text fields(name,zipcode,city,state), a submit button and a hidden commandButton(id=autofill).This hidden button is clicked on
value change of zipcode field using javascript onchange="document.getElementById('autofill').click();"
Here,
-the zipcode,city and state fields have immediate="true" (so that they are validated)
- added f:validateLength to the zipcode field
Following are my doubts:
1.Correct me if I'm wrong.
The sole purpose of immediate=true for value change events is to avoid validation errors and needs to be used with a hidden commandButton with
immediate=true.
2. Always if immediate=true for any input field,there will be a hidden commandButton whose immediate=true.Hence it will never go through the Process Validations phase.It will go through Restore View,Apply Request Values and Then Render Response phase.If so who does the validations that are attached to fields with immediate=true.
3.Now the zipcode is validated as I run the application.But, when I attach MyPhaseListener class to this,it is not printing processValidations phase at all.Is it because the hidden commandButton immediate=true.If so, who does the validations if immediate="true" for hidden commandButton?