> if your going to store the form. variables as session
> variables for this one form then you need to change the
> attribute for them, a quick albeit dirty way to do it:
>
> <cfloop list="#form.fieldlist#" index="field">
>     <cfset "session["#trim(field)#"] =
> "#evaluate("form.#trim(field)#")#">
> </cfloop>

Yikes, that really is dirty! Also, there's no variable called
FORM.FIELDLIST, it's FORM.FIELDNAMES, and if there are duplicate names such
as you'd have with a checkbox array or a multi-select box, you'll end up
with only the last value. If you're using CF 4.5, both Session and Form are
structures, so you can loop over the Form structure as a collection rather
than looping over the list of field names:

<CFLOOP COLLECTION="#Form#" ITEM="myfield">
        <CFSET Session[myfield] = Form[myfield]>
</CFLOOP>

If you're using CF 4.0.x, you could do this:

<CFLOOP LIST="#Form.Fieldnames#" INDEX="myfield">
        <CFIF NOT IsDefined("Session." & myfield)>
                <CFSET Session[myfield] = Evaluate("Form." & myfield)>
        </CFIF>
</CFLOOP>

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to