Can we pass the whole structure by url?

I open a new popup when I click the url on my page. My question here is, can I pass the entire structure to a new page?

If this is not possible, is there any easy way to do this?

+2


a source to share


5 answers


Expanding on James Buckingham's answer ...

(This assumes session control is set to true

.)

On the calling page, just copy the structure into your session variable:

<cfset session.myTempStruct=variables.myTempStruct />

      



Then, in the popup, copy the structure back to the local scope for this request:

<cfset variables.myTempStruct=session.myTempStruct />

      

If you don't want this structure to hang in the session, you can be prompted for a popup to remove it from the session as soon as it is copied to the local scope.

<cfset structDelete(session, "myTempStruct") />

      

+1


a source


Is the page open in the url of the same app?

If so it would be better to keep the structure in the user session and pull the information that way. Cleaner urls, code and more secure.



Cheers, James

+8


a source


Although NOT HIGHLY recommended , you can 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 would suggest submitting the information via a form, not a URL.

You always have the option of storing data in a persistent object like a bean, or a simpler approach like a session.

Hope this helps you

+1


a source


You can add your data points as parameters to the end of the URI, but I am not suggesting using the method you see as it will be very vulnerable to injection.

0


a source


Serializing Struct (with serializeJSON () or whatever) and puttin git in the url seems to make sense as long as the structure isn't too big (read: less than 3-4k characters in total).

Another solution would be to put this in some general area: session, application, etc.

Third, one would need to call cfm with a POST request that can handle large structures and then a GET.

0


a source







All Articles