Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

StructCopy(form) will not hold?

Engaged ,
Dec 02, 2010 Dec 02, 2010

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?

731
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Dec 02, 2010 Dec 02, 2010

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.

Translate
Valorous Hero ,
Dec 02, 2010 Dec 02, 2010

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 02, 2010 Dec 02, 2010
LATEST

Sweet, thaks, that did the trick....

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2010 Dec 02, 2010

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

Dave Watts, Eidolon LLC
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources