Hi, I am opening a new popup window on click of an URL in my page. My question over here is Can i pass whole structure to the new page ?
If thats not possible is there any simple method to do that ?
Hi, I am opening a new popup window on click of an URL in my page. My question over here is Can i pass whole structure to the new page ?
If thats not possible is there any simple method to do that ?
You can add your data points as parameters to the end of the URI, but I do not suggest using the method you see as it would be highly subject to injection.
Although HIGHLY NOT recommended, you could do this:
<cfset tmp = {} />
<cfset tmp.name="Marcos" />
<cfset tmp.lname="Placona" />
<cfwddx action="cfml2wddx" input="#tmp" output="tmpWDDX">
<a href="index.cfm?string=#tmpWDDX#">link</a>
If you decide to take this approach, I'd suggest sending the information via form as opposed to URL.
You always have the option to store the data in a persistent object such as a bean, or a more simple approach such as a session.
Hope this helps you
Is the page being opened in the URL part of the same application?
If so a better way would be to save the structure in the user's session and pull in the information in that way. Cleaner URLs, code and more secure.
Cheers, James
Serializing Struct (with serializeJSON() or something) and puttin git in URL seems reasonable in case struct is not too big (read: less than 3-4k characters in total).
Other solution would be to put this in some shared scope: session, application etc.
Third, would be to call cfm with POST request which can handle larger structs then GET.
Expanding on James Buckingham's answer...
(This assumes you have session management set to true
.)
In the calling page, simply copy your structure to a session variable:
<cfset session.myTempStruct=variables.myTempStruct />
Then, in the popup, copy the structure back to the local scope for that request:
<cfset variables.myTempStruct=session.myTempStruct />
If you don't want that structure to hang around in the session, you can have the request for the popup remove it from the session right after copying it to the local scope.
<cfset structDelete(session, "myTempStruct") />