I have a custom tag I built just to avoid having to deal with this issue altogether. 
It takes every form var, puts it into the session.YOUNAMEIT scope then converts 
everything in the session.YOUNAMEIT back into the form scope. That way you can go from 
Form A to Form B to Form C and back to Form A then to Form C and every form var you 
collected along the way is still available in the form scope. It works great and saves 
a lot of time when coding multi form wizard type data collection. Here is the code.... 
enjoy.

 Justin Hansen
~~~~~~~~~~~~~~~~~~~~~~
 Uhlig Communications
 Systems Engineer
~~~~~~~~~~~~~~~~~~~~~~
 [EMAIL PROTECTED]
 913-754-4273 Office
 913-568-7961 Mobile
~~~~~~~~~~~~~~~~~~~~~~

<!--- START TAG CODE --------------------------------------- --->
<!-- cf_form2struct -->
<cfsetting enablecfoutputonly="Yes">
<!--- 
        form2struct.cfm (custom tag) by Justin Hansen - [EMAIL PROTECTED]
        required attribute = StructName
                
        I convert any passed from vars into a session struct named 
'session.#attribute.StructName#'
        and then convert them all back to form vars for use in the calling page.
        
        <cf_form2struct StructName="hello">
 --->

<!--- make sure it exists --->
<cflock type="READONLY" scope="SESSION" timeout="10">
        <cfset locStructDefined = isDefined("session.sg.tag.#attributes.StructName#")>
</cflock>

<!--- create sturct if it does not exist --->
<cfif locStructDefined eq 0>
        <cflock type="EXCLUSIVE" scope="SESSION" timeout="10">
                <cfscript>
                        "session.sg.tag.#attributes.StructName#" = StructNew();
                        "session.sg.tag.#attributes.StructName#.form2sturctStartStamp" 
= Now();
                </cfscript>
        </cflock>
</cfif>

<!--- make sute we have form vars first else skip it --->
<cfif isDefined("form")>
        <!--- convert form.vars to session.StructName.vars --->
        <cflock type="EXCLUSIVE" scope="SESSION" timeout="10">
                <!--- New Stuff -- --->
                <cfloop collection="#form#" item="i">
                        <cfif i neq "FIELDNAMES" and i neq "X" and i neq "Y">
                                <cfset "session.sg.tag.#attributes.StructName#.#i#" = 
trim(form['#i#'])>
                        </cfif>
                </cfloop>
        </cflock>
        
</cfif> 

<!--- convert session.StructName.vars to form.vars --->
<cfscript>
        locTempStruct = StructNew();
</cfscript>

<cfloop collection="#session.sg.tag['#attributes.StructName#']#" item="i">
        <cfset "form.#i#" = session.sg.tag['#attributes.StructName#']['#i#']>
</cfloop>

<cfsetting enablecfoutputonly="no">
<!--- END TAG CODE --------------------------------------- --->




-----Original Message-----
From: Jim McAtee [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 29, 2003 12:15 PM
To: CF-Talk
Subject: Re: Doing Forms in Series


> >I don't really want to stash the data in a temporary table, since this web
> >site
> >currently isn't data-driven and has no data source available.  Also, I don't
> >want to user session variables.
>
> When the second form is being built, just create hidden form variables
> holding the values from the first form. When you submit the second form,
> both groups of vars get passed. Essentially you're transferring the first
> batch of data twice, but unless you've got a ton of data, it shouldn't be
> an issue.

No problems there.  I already use hidden form fields within the second form.
The quesion is how to get from the template that displays FormA to the template
doing FormB by doing a POST.  I commonly do this with a CFLOCATION and URL
variables when there's not much data to be passed.  It's not as simple to do a
POST.

Maybe the answer is to use a single template and then CFINCLUDE the individual
forms from that template (or they could be entirely contained in one template
if I want to manage one gigantic source file).

Jim


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to