I would like to pass complex structures via the URL. I know
this can be done using hidden fields in forms but sometimes, I need
to pass data from a file that is not a form. I'm having problems
getting this to work. I have a really simple file that sets up a
structure, serializes it using wddx and then attempts to pass the
serialized structure from a hyperlink. The file that is called
de-serializes the structure and tries to access it. I'm getting an
error:
WDDX packet parse error at line -1, column -1. Premature end
of file..
on the de-serialization line. I know that things are
serialized/de-serialized correctly because if I serialize and then
deserialize in the same file (without passing it to another file
via URL), I can access it fine.
Is it possible to send WDDX packets to another cfm file via
the URL?
Here is my simplified code:
dsp_testPage.cfm
-------------------------
<cfset relatives=StructNew()>
<cfset relatives.field1 = "Dad">
<cfset relatives.field2 = "Mom">
<cfset relatives.field3 = "Sister">
<cfset relatives.field4 = "Brother">
<cfwddx action="cfml2wddx" input="#relatives#"
output="wddxRelatives">
<br>
<a
href="./index.cfm?fuseaction=test&relatives=#wddxRelatives#">Click
Here</a>
--------------------------------------------------------------------------------------------------------------------
Then I have another page called index.cfm (I'm using fusebox)
that looks like this:
<html>
<head></head>
<body marginheight="0" topmargin="0" marginwidth="0"
leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<cfparam name="attributes.fuseaction" default="home">
<cfswitch expression="#attributes.fuseaction#">
<cfcase value="home">
<cfinclude template="./dsp_DISPLAY/dsp_TESTPage.cfm">
</cfcase>
<cfcase value="test">
<cfwddx input="#attributes.relatives#" action="WDDX2CFML"
output="localAppData">
<cfoutput>
<br>Inside Test<br><br>
field1 = #localAppData.field1#<br>
field2 = #localAppData.field2#<br>
field3 = #localAppData.field3#<br>
field4 = #localAppData.field4#<br>
</cfoutput>
</cfcase>
</cfswitch>
</body>
</html>