Your first method creates a reference to the form scope, but does not store the 
data for that reference in separate memory space. That's why the structure is 
blank in the second page- the form scope has changed, and your session variable 
is still just a reference to form scope.

In the second example, you are creating a separate copy of the form data in its 
own memory space (and NOT a reference to the form scope), so changing the form 
scope does not affect it.

> 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)>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:196023
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