If I understand correctly, what you did was a pointer copy.  When you go
to the next page, CF has deleted the form scope for the previous
request, so you are (basically) right that CF reuses memory.

To make the form data persistent, you should use scopecopy() which does 
a "deep copy" of the data.

--Ben

Ian Skinner wrote:
> This is a thought question to get a better understanding on what is
> going on under the hood.
> 
> I just finished debugging this issue; apparently ColdFusion reuses
> memory for the form scope.
> 
> If one has the following code in two files.  On page one, you get
> what I expect, the form fields showing up as keys of the session.form
> structure.  Since complex data structures are passed by reference, I
> figured that since I had a persistent reference to the current form
> structure it would exist on the next page.  But it does not.  The
> form key will be in the session scope on page two, but it will be an
> empty structure.  What I deduce from this is that CF is using the
> same memory for the form structure and creating an empty structure in
> this memory when they there is no form data from the request. Does
> this sound correct?
> 
> File one <!--- an action page to some form ---> <cfset session.form =
> form> <cfdump var="#session#"> <a href = "fileTwo.cfm">Next page</a>
> 
> File two <cfdump var="#session#"
> 
> Now this was easily fixed once I tracked down the problem with the
> following modification.  So, I am not trying to solve the problem
> just getting a better understanding of how CF really works.  This is
> on 6.1 by the way.
> 
> <cfset session.form = duplicate(form)>
> 
> 
> -------------- Ian Skinner Web Programmer BloodSource 
> www.BloodSource.org Sacramento, CA
> 
> "C code. C code run. Run code run. Please!" - Cynthia Dunning
> 
> Confidentiality Notice:  This message including any attachments is
> for the sole use of the intended recipient(s) and may contain
> confidential and privileged information. Any unauthorized review,
> use, disclosure or distribution is prohibited. If you are not the 
> intended recipient, please contact the sender and delete any copies
> of this message.
> 
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:196024
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to