Hi. I have a multi-page user registration system that handles this in a complicated, but clean way. I'll describe the whole thing:
reg_init.cfm - Sets a series of Session variables corresponding to the form fields on all registration pages, e.g., Session.frmFirstName, Session.frmPhoneNumber, etc. Creates another series of session variables that are error indicators, named as field name followed by _ERR, e.g., Session.frmFirstName_ERR, etc. All values are set to zero-length strings or default values. This allows future pages to count on them no matter where the user is in the process, which accounts for strange paths through the multi-form "wizard". reg1.cfm - The first form page in the registration process. Pulls values from Session variables (created in reg_init) into local variables, and plugs those values into the appropriate form fields. Next to each form field is a little red X image that is displayed IF the field_ERR variable is not "". Since field_ERR will be filled with the error text (see next page, reg1_action.cfm), a JavaScript routine is also set there so that clicking on the red X shows the error message for that particular field. On submission, this page runs a series of simple JavaScript checks, leaving the more complicated validation for the next page. reg1_action.cfm - Does the heavy-duty form validation. If a value fails a test, its corresponding _ERR variable gets set to a message. Form variables are written to corresponding session variables for future use. At the end of this template, if a toggle variable shows that one or more variables failed validation, the user is bounced back to reg1.cfm. If the variables are all okay, the user is sent forward to reg2.cfm. The next registration pages are all the same, where they occur in pairs (reg2, reg2_action, etc.) The final page re-validates everything (yes, I know, I'm paranoid), pulls the session variables into local variables, kills the session variables, writes the entire record to the database, and goes to a "congrats!" page. I designed it this way based on the idea that every page should work right no matter what the preceding page is. Whether you are coming forward or backward through the "wizard" or getting bounced back because of an error, you still get the right results. If you set up your app like this, when the user selects something from the notes window, it should get saved in a session variable (by the _action page) and then "pre-selected" on the form page when it gets bounced back. Hope this helps. If you want me to explain any part of this, please let me know. Matthieu -----Original Message----- From: jgeorges [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 08, 2002 2:52 PM To: CF-Talk Subject: RE: Browser losing data with back button Tony, Thanks for your response. The first page contains a lot of data that is pulled in from a number of datasourses. The validation is somewhat complicated. I have used your suggestion on simpler pages. I was hoping there was a simpler solution. Sam --- On Thu 08/08, Tony Carcieri wrote: From: Tony Carcieri [mailto: [EMAIL PROTECTED]] To: [EMAIL PROTECTED] Date: Thu, 8 Aug 2002 14:36:47 -0400 Subject: RE: Browser losing data with back button > have something like: > > onSubmit="return verify(this)"> > > and in your head: > > > function verify(){ > > // Initialize field values > error = false; > ErrorMessage = 'Please correct the following errors...\n\n'; > > //Validate First Name > if(document.form1.FirstName.value.length ErrorMessage = ErrorMessage + 'First Name is required. \n'; > error = true > } > > //Validate Last Name > if(document.form1.LastName.value.length ErrorMessage = ErrorMessage + 'Last Name is required. \n'; > error = true > } > > } > > > -----Original Message----- > From: jgeorges [mailto:[EMAIL PROTECTED]] > Sent: Thursday, August 08, 2002 2:27 PM > To: CF-Talk > Subject: OT: Browser losing data with back button > > > I have a form when submitted goes to a validation page. If there are > errors, the errors are listed followed by a button that goes back to > the form using "JavaScript:history.go(-1);return true;". > > On the form one of the text boxes can be filled from a pop-up window. > > If the pop-up window is used and there are errors listed on the > validation page, when the user clicks the back button in the browser > (IE5.5) or clicks the button provided, the form loses all data entered > or changed. > > If the pop-up is not used, all data entered or changed is preserved. > > This problem does not occur using Netscape. Is ther a fix for IE? > > Any help would be appreciated. > > Thanks, > > Sam > > > > > > ------------------------------------------------ > Can a Web portal forever change your life? > Win up to $25 Million on iWon - click here! > > ______________________________________________________________________ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

