Copy link to clipboard
Copied
I am porting an application from CF5 to CF7 and in the app I have working code that copies the the contents of a form to a session variable so that I can use the information throughout the rest of the app.
<cfset session.stCustomerData = structCopy(form)>
This works great in CF5 and on the forms landing page the data is populated. But as soon as I leave the landing page (Link or Form Submit) the stCustomerData struct is missing from the session? ONLY the stCustomerData data?
If I loop through the form keys, it works.
<cfloop list="#StructKeyList(form)#" index="i">
<cfset SetVariable("session.stCustomerData.#i#", evaluate("form." & i))>
</cfloop>
I really don't want to scrube through 10 years woth of code to find all these! Any ideas?
You might need to look at the difference between StructCopy() and Duplicate() as one only creates a pointer the the current data in memory and the other creates a true copy of the data in another memory location. With the former, when the original data is destroyed (such as form data when the request is completed) all pointers at the data will also be gone.
Copy link to clipboard
Copied
You might need to look at the difference between StructCopy() and Duplicate() as one only creates a pointer the the current data in memory and the other creates a true copy of the data in another memory location. With the former, when the original data is destroyed (such as form data when the request is completed) all pointers at the data will also be gone.
Copy link to clipboard
Copied
Sweet, thaks, that did the trick....
Copy link to clipboard
Copied
Use Duplicate instead of StructCopy.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/
Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.
Read this before you post:
http://forums.adobe.com/thread/607238