PDA

View Full Version : Preserving ListMenu input when form validation fails?


EagerNewby
04-22-2011, 11:34 AM
Hello,
I am new to the forum, and as my handle suggests, new to PHP coding in general. Currently I am developing a user registration form with validation of all input fields. Using DW 5, Zend Framework, WAMP. I have coded all user input fields (name, address, city, zip, phone etc.) as textfields with the exception of the state (geographic) user input, and for that I used a dropdown ListMenu with the initial menu state (appearance) indicating "Choose one". Using Zend validation and various regex(s), as well as the sha1 function I have been able to validate all my users input. In the case of the user's state (geographic) input, I do not need to validate my users choice, as I am providing my user with a predefined list of all 50 geographic states in the form of the listmenu to choose from.
I have also been able to redisplay on error all correctly validated input fields with the exception of the states listmenu which resets to its initial appearance when another form input field fails validation and the user is asked to make corrections and resubmit.
What I would like to have is the form listmenu hold the users initial choice when the page reloads for correction.
Could any of you master coders out there give me a hand?
Advice would be much appreciated.

Sincerely,
Eager