I have encountered the same problem and solved it this way.
 
First you DO need to enable session management. Then create an initialization page that creates a session variable for each form field you will use. Each session variable name should be the same as the name of its corresponding form field. This allows you to use these session variable values as default values for the form fields and means that if the client backs up through the forms, the data last entered will still be there. At the top of each next (action) page add the following code.
 
<cfloop collection="#form#" item="frmVar"> <!---  loop through the form variables --->
 <cfif #frmVar# neq "Submitme" and #frmVar# neq "fieldnames"> <!---  exclude the submit button and the fieldnames string --->
  <cfset v = structinsert(session,frmVar,form[frmVar],true)>  <!---  create a session variable named after the form field and install the form field's value --->
 </cfif>
</cfloop>
 
This automatically will put each form field's value into the appropriate session variable. All the session variables will be available to use as you like when the form is completed.
 
I also opened the job in a new window without the window decorations that include the BACK button and created my own navigation bar with it's own FIRST, PREVIOUS, NEXT, and LAST buttons. This allowed me to add code to those buttons so that for instance, if the client filled in a form and hit the PREVIOUS button, they would first go to the next (action) page which would save their form variables as session variables then take them back to the page they requested without them seeing the next (action) page.
 
It was a lot of coding but the result was well worth it.

[Dave Boehm] 
 
 -----Original Message-----
From: Arun Persaud [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 05, 2002 10:26 AM
To: [EMAIL PROTECTED]
Subject: [CFTALKTor] passing variables in forms

I have a questionnaire that is split into 7 forms (i.e. Step 1 to Step 7).
 
What's the best way to pass the form variables from each form to the next so they can all ultimately be uploaded when the user reaches the Step 7 form? I should mention that each form is way too long. Not by choice.
 
Are sessions somehow involved in accomplishing this?
 
Thank you.
 
 
Arun

Reply via email to