Hi Ian, Here are a few ideas regarding this.
 Best deal with session variables within a CFLOCK statement (see docs for 
details of possible race conditions) and therefore a useful way to go about 
this is to copy any session structures to the request scope on each request.
 I have a similar 'wizard' style process and I create a structure (inside 
cflock) session.wizard 
 For each wizard step I create session.wizard.stepN (where N is step 
number). 
 I then duplicate this structure to the request scope so that I can forget 
about locking from now on.
 In each form page I CFPARAM request.wizard.stepN.formfieldN for all my form 
fields for this step with any default values.
 When the form is submitted I cfloop thru the form structure and copy the 
form values to the request.wizard.stepN.formfieldN values. Finally I 
duplicate the request scope to the session scope inside a CFLOCK so the 
values are remembered to the next request.
 In terms of keeping this data in some way, you might consider using CFWDDX 
which can convert complex CFML variables (like your wizard structure) and 
convert them to a XML string. You could then write this string to a file or 
database. CFWDDX can then be used to convert it back again. There are many 
ways to store this data but this in my mind would be the neatest.
 HTH
Mike
   

 On 9/5/05, Ian Vaughan <[EMAIL PROTECTED]> wrote: 
> 
> Hi
> 
> I am starting constructing a form using session variables for multiple
> page data entry which works fine.
> 
> However I would like to add the facility of a 'SAVE AND RETURN' later
> option.
> 
> So for example the user can start completing the form but can return at
> a later date to complete the form before it is submitted.
> 
> What would be the best way to achieve this ?
> 
> My current form is shown below
> 
> TIA
> 
> 
> 
> <!--- Total Number of Steps in the Wizard --->
> 
> <cfset numberofsteps = 3>
> 
> <!--- The SESSION.app structure holds users entries --->
> <!--- As they move through wizard. Make sure it exists! --->
> 
> <cfif not isdefined("SESSION.app")>
> <!--- If the structure is undefined, create or initialize it
> --->
> <CFSET SESSION.app = structnew()>
> <!--- The code below represents the users progress in the wizard
> --->
> <cfset SESSION.app.stepNum = 1>
> <!--- We will collect these from the user; start as blank values
> --->
> 
> <cfset SESSION.app.jobtitle = "">
> <cfset SESSION.app.jobdesc = "">
> <cfset SESSION.app.salary = "">
> </cfif>
> 
> <!--- If user just submitted jobtitle, remember it --->
> <!--- Do same for the directorID, Actors and so on --->
> 
> <cfif isDefined("FORM.jobtitle")>
> <cfset SESSION.app.jobtitle = Form.jobtitle>
> <cfset SESSION.app.jobdesc = Form.jobdesc>
> <cfelseif isDefined("FORM.salary")>
> <cfset SESSION.app.salary = Form.salary>
> </cfif>
> 
> <!--- If user clicked the 'Back' button, go back a step --->
> <cfif isDefined("FORM.goBack")>
> <cfset SESSION.app.stepnum = URL.stepNum - 1>
> <!--- However if the user clicked 'Next' go forward one --->
> <cfelseif isDefined("FORM.goNext")>
> <cfset SESSION.app.stepnum = URL.stepNum + 1>
> <!--- If the user has finished, were complete --->
> <cfelseif isDefined("FORM.goDone")>
> <cflocation url="idvprocess.cfm">
> </cfif>
> 
> <!--- END COLDFUSION LOGIC --->
> 
> <html>
> <head><title>Test</title></head>
> <body>
> 
> <!--- Show title and current step --->
> 
> <cfoutput>
> <b>TEST FORM</b><br />
> Step #SESSION.app.stepNum# of #numberofsteps# <br />
> </cfoutput>
> 
> 
> <cfform action="idv.cfm?StepNum=#session.app.StepNum#" method="POST">
> <!--- Display the appropriate wizard step --->
> <cfswitch expression="#session.app.stepNum#">
> <!--- STEP 1 : Movie Title --->
> <cfcase value="1">
> <!--- Get potential film ratings from database ? --->
> 
> 
> <!--- Show text entry field for title --->
> Job Title<br>
> <cfinput name="jobtitle" size="50" required="Yes" message="Please enter
> a job title" value="#SESSION.app.jobtitle#">
> <p>
> What is the job description ?
> </p><br />
> <cfinput name="jobdesc" size="50" required="Yes" message="Please provide
> the job description" value="#SESSION.app.jobdesc#">
> 
> 
> </cfcase>
> 
> <cfcase value="2">
> <cfinput name="salary" size="50" required="Yes" message="Please provide
> the pitch text first" value="#SESSION.app.salary#">
> </cfcase>
> 
> <cfcase value="3">
> You have successfully finished the form
> </cfcase>
> </cfswitch>
> 
> <p>
> <cfif SESSION.app.stepNum gt 1>
> <INPUT type="submit" Name="goBack" value="&lt;&lt; Back">
> </cfif>
> 
> <cfif SESSION.app.stepnum lt numberofSteps>
> <INPUT type="submit" Name="goNext" value="Next &gt;&gt;">
> <cfelse>
> <INPUT type="submit" Name="goDone" value="Finish">
> 
> </cfif>
> 
> 
> </cfform>
> 
> 
> </body>
> 
> 
> </html>
> 
> 
> 
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217352
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to