[thelist] CF: Moving a struct to a session.var
Frank
framar at interlog.com
Wed Aug 14 20:27:00 CDT 2002
Help! I'm stuck. I'm playing around with structs. The user has completed a
form with some basic information. I want to set it to a struct in the
session scope that I can move from page to page without losing the data.
The code below (formatted this way just to deal with wrapping) is an
example of what I'm using. I keep getting the "can't resolve parameter"
error. All my other session variables carry through.
(Tangent: How *does* one output in a cfscript?)
Many thanks.
<!--- User has submitted details, set to session.struct --->
<cflock timeout="10"
throwontimeout="No"
type="Exclusive"
scope="Session">
<cfscript>
<cfoutput>
ContactDetails=StructNew();
StructInsert(ContactDetails
,"EmailAddress"
,"#Form.EmailAddress#");
StructInsert(ContactDetails
,"FirstName"
,"#Form.FirstName#");
StructInsert(ContactDetails
,"LastName"
,"#Form.LastName#");
// Copy this struct to a session variable
Session.ContactDetails=StructNew();
Session.ContactDetails=StructCopy(ContactDetails);
</cfoutput>
</cfscript>
</cflock>
<!---
Feedback page: (Here's what you told us)
This will then be prettied up, to confirm to the user that this is what
they've entered, then later used in an email, then inserted into the db
--->
<cflock type="readonly"
scope="session"
timeout="10"
throwontimeout="no">
<cfloop collection="#Session.ContactDetails#" item="key">
<cfoutput>
Session.ContactDetails['#key#']:
#Session.ContactDetails[key]#
</cfoutput><br>
</cfloop>
</cflock>
Frank Marion
framar at interlog.com
More information about the thelist
mailing list