<!--- these couple of lines will dump every form field just submitted into session structure called "stcFormFields". Each entry will be named according to its form field name. e.g. a field named ThisField would be added as session.stcFormFields.ThisField and it's value stored here--->
<cflock scope="session" throwontimeout="no" timeout="20">
<cfset session['stcFormFields'] = StructNew()>
<cfset StructAppend(session['stcFormFields'],form)>
</cflock>
as for keeping the data in the fields, i had params for each field at the top of each form
if the session stcFormFields existed, i used the values there for the cfparam defaults
then each field ofcourse was its own value
e.g ---- <input type="text" name="ThisField" value=#form.ThisField#">
as long as the session was alive the user could move back and forth between all of the steps however they wanted without losing what they had entered
once the last step was reached, I simpley deleted the keys Form.FieldNames and any key that contained the word "Submit" from the session structure since I named all of my buttons like... "StepOne_Submit", StepTwo_Submit", etc...
----- Original Message -----
From: Arden Weiss
To: CF-Talk
Sent: Saturday, August 07, 2004 10:43 PM
Subject: forms and sub-forms best practices feedback desired
In many cases I have a master form/page with a dozen or so fields.
On the master form/page I also have one or more buttons that call sub-forms/pages for purposes of maintaining multiple records associated with the master form/record (in a one to many relationship).
The question I have is "What is the best practice to use to maintain state in the master form/page while working with the sub-form/pages -- so any changes that have been made in the fields on the master form/page re-appear when the master form/page reloads?
Right now I am using client scoped variables to do the trick to avoid using cflock with session scoped variables.
Is this the best practice or is another approach mo-betta???
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

