WDDX is nice, and can be stored in client variables (be wary of string
length limitations). This method generally works quite well.
If you want to pass through hidden form fields there are methods of doing
this that can be very powerful...
*** At the top of every page put this code:
<cfparam name="form.hidFormWddx" default="">
<cfset foo = form>
<cfif form.hidFormWddx NEQ "">
<cfwddx action="WDDX2CFML" input="#form.hidFormWddx#" output="foo">
<cfset form.hidFormWddx = "">
<cfif isdefined("form.fieldNames")>
<cfloop list="#form.fieldNames#" index="i">
<cfset "foo.#i#" = evaluate("form." & i)>
</cfloop>
</cfif>
</cfif>
<cfwddx action="CFML2WDDX" input="#foo#" output="form.hidFormWddx">
*** in the form of every page put this code:
<input type="hidden" name="hidFormWddx" value="#form.hidFormWddx#">
What does this do? It records all form fields to a different struct then
serializes them. It makes no difference how many pages or how many form
fields you have. At any given time on any given page you will have access
to all the form variables through the POO struct (poo.field1, poo.field2)
+-----------------------------------------------+
Bryan Love
Macromedia Certified Professional
Internet Application Developer
Database Analyst
Telecomunication Systems
[EMAIL PROTECTED]
+-----------------------------------------------+
"...'If there must be trouble, let it be in my day, that my child may have
peace'..."
- Thomas Paine, The American Crisis
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 14, 2001 1:17 PM
To: CF-Talk
Subject: RE: Passing form field data
thanks, the second option sounds interesting. I'll try that.
-----Original Message-----
From: Tyler M. Fitch [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 14, 2001 10:29 AM
To: CF-Talk
Subject: RE: Passing form field data
You're going to have two options.
1) Use session variables. On the action for each page loop over
FORM.fieldnames and append those fields and values to your
session.st5stepProcess - Sessions are the easiest, but they and locking
are avoidable if you want to try the next method.
2) Use WDDX. The trick with using WDDX in this fashion is that you're
going to end up with WDDX inside other WDDX. The first pages info will
be inside a field of the second pages WDDX fields, the second inside the
third and so on. So you'll need to convert the WDDX using the
xmlformat() function. If you try to deserialize a WDDX packet with
another inside you'll get an error. The progression is like this
First page -
Your normal form
In the second page -
<cfwddx action="CFML2WDDX" input="#FORM#" output="wstPage1">
<form>
<input type="hidden" name="wstPage1" value="#wstPage1#">
In the third page - the part where you have to start paying attention
<cfset FORM.wstPage1 = xmlformat(FORM.wstPage1)> <!--- now all the < are
< etc... --->
<cfwddx action="CFML2WDDX" input="#FORM#" output="wstPage2">
<form>
<input type="hidden" name="wstPage2" value="#wstPage2#">
Then when you want to pull it all out
<cfwddx action="WDDX2CFML" input="#FORM.wstPage2#"
output="variables.wstPage2">
<cfwddx action="WDDX2CFML" input="#variables.wstPage2.wstPage1#"
output="variables.wstPage1">
This will then give you a couple of different structs to play with that
then contain all your data.
I haven't pushed it past three pages, but I'm pretty sure if you keep up
the progression of WDDX and xmlformat it will keep working.
I ended up using CFDUMP quite a bit to make sure things were getting
passed properly. It'll help a great deal.
HTH,
t
**********************************************************************
Tyler M. Fitch
Certified Advanced ColdFusion 5 Developer
ISITE Design, Inc.
615 SW Broadway Ste. 200
Portland, OR 97205
503.221.9860 ext. 111
http://isitedesign.com
**********************************************************************
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 14, 2001 9:50 AM
To: CF-Talk
Subject: Passing form field data
Hi,
I have a very long form which i have broken down into 5 pages. My
question is what's the best way to store and pass form fields from each
page to the last page where all field data will be sent to a database.
thanks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.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