Form Validaton, Select Menus Losing Session Info
Posted on 2006-05-05
I have a two page processing set up, form and action page with error checking for required fields. All fields are stored in a session but I am having sort of two problems with select menus.
First off, if a user missed a required field on the form page when they submitted to the action/processing page, select menu values that were stored in the session did not update themselves. So if a user had chosen the state of California on the form page, on the action/processing page it was back to the default 'Choose A State'. This was the case for all select menus on the page. To altered the select menus on the action page as such;
message="Please select your State">
<OPTION value="#session.buynow_nfo.State#" selected><cfoutput>#session.buynow_nfo.State#</cfoutput></OPTION>
Which worked, or so I thought. If the user makes an error in a text field or select menu, select menus that have been selected did update with the session info passed to the action page. However, if a user makes TWO mistakes and therefore submits the form twice all select boxes lose the session info and display the #session.buynow_nfo.NAMEOFFIELD# fix, I thought I had created.
This is not seen as an error, so when and if all the required text fields are correct the form submits and the select values all come through with #session.buynow_nfo.NAMEOFFIELD#
How can I fix this?