You have several choices. Session variables are certainly one. The biggest risk there is that if the user fails to respond in the "timeout" timeframe on any of the forms, all the data will be lost. Not very customer-friendly. :-)  Session variables also would not work if you worked in a clustered environment (multiple servers appearing as one web site), where page 3's form submission may be sent to a different server than that which processed page 1.
 
Of course, one response to that is to store the data more persistently between the requests (each form submission). Client variables are one possibility. These are like session variables in that they're per-visitor, but they're persisted over a longer timeframe (set in the administrator).   You can also choose (in your CFAPPLICATION) tag whether to store them in the registry, your visitor's cookies, or in a database of your choice. There is also a setting in the administrator to choose one of those 3 values as the default in case you don't select one for your application, as well as a setting for how long to store them for a given visitor if stored in either the registry or a particular datasource.  This is all covered in the docs at http://livedocs.macromedia.com/cfmxdocs/Developing_ColdFusion_MX_Applications_with_CFML/sharedVars4.jsp. (And if you use clustering, then the registry option for storing client variables is the wrong choice, as it may be for other reasons as well.)
 
If you want to manage the storing of data in a database yourself between requests, you could do that. It's worth pointing out that for both that approach and the client variable approach, you need to think about how to handle the situation where a user returns to your submission forms somewhere in the middle of the process. What if they make a bookmark? Should you stop them or allow them to proceed? What if their machine suffers an outage in the middle? How can they recover?
 
There's yet another alternative for tracking the data from page to page in a multiple form submission process. It's a simpler one that avoids all these issues. On each page that processes a previous form submission, you add the fields that were submitted as hidden fields to be held on the next page, and so on, until done. Ben Forta even created a custom tag for this, cf_embedfields (http://devex.macromedia.com/developer/gallery/info.cfm?ID=CA34704C-2830-11D4-AA9700508B94F380&method=Full). 
 
 
 
/charlie
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Arun Persaud
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