+ Start a Discussion
Jon KeenerJon Keener 

avoiding required="true" check on inputFields when rerendering a section of a page.

In a form, if an inputField has the parameter ' required="true" ' set, if a commandButton or something else on the page rerenders the section of the page with that inputField, the required validation is performed, regardless of if the immediate="true" switch on the commandButton is used.  So if the inputField is empty at the time this is rerendered, the rerendered version appears with an error below it stating that the field needs to be populated.
 
What I would like to be able to do is to have an option to rerender without this required="true" being validated.  In this specific situation, some buttons on the screen modify the look and feel of the screen, which I do not want to perform this validation.  I only want to perform the validation in this case, being a wizard, when the "next" button is pressed.  This would also be extremely helpful in a wizard for the "previous" button, so that the required logic could be bypassed if going backward in the wizard.
 
Currently the only solution I see to this is to not use the required parameter, place my own red line by my required fields, and perform the required field logic manually, so I can rerender the sections correctly and avoid the messages.  If someone has come across another more elegant approach using the required parameter, please let me know.
 
Thanks!
 
Jon Keener
jwetzlerjwetzler
Hi Jon.  Does your button have to be inside the form that holds the inputField?  Because if you move the button to its own form it should work.

I don't really have an explanation for why that wouldn't work with the immediate flag set, but let me know if that fixes your issue.

Jill
yibongleeyibonglee
Jill,

It works!

I put the button in the other form.

Thanks!

Message Edited by yibonglee on 11-11-2008 12:00 PM