Skip to main content
Participant
July 7, 2006
Question

Form Hidden Structure Data

  • July 7, 2006
  • 1 reply
  • 219 views
I have a form and need to pass a structure as a hidden item.
I convert the structure using cfwddx I assign the converted structure to the value of a hidden item
When the cfm is called, it is unable to de-serialize the converted structure. I get the following error:

WDDX packet parse error at line 1, column -1. Document root element is missing..

I dump the Form variable and only see <wddxPacket version= as the converted structure.

Here is my code:

<cfif recnum_Found>
<cfquery name="Get_Scenario_Status" datasource = "#dashboards_db#">
select * from dashboard_project_status
where SRec = #Form.SRec#
</cfquery>
<cfelse>
<cfset Get_Scenario_Status = StructNew()>
<cfset Get_Scenario_Status.Or_Ack_chk = 0>
<cfset Get_Scenario_Status.Or_Ack_dt = "">
<cfset Get_Scenario_Status.Or_Ack_int = "">
...
</cfif>

...

<cfwddx action = cfml2wddx input = #Get_Scenario_Status# output = ES_wddx>
<form action="/temp/FUPSI.cfm" method="post">
<cfif IsDefined("Get_Scenario_Status.SRec")>
<input type="hidden" name="Existing_Scenario_wddx" value=<cfoutput>#ES_wddx#</cfoutput>>
...
<input type="hidden" name="recnum" value=<cfoutput>#recnum#</cfoutput>>
...
<input type="hidden" name="pbname" value=<cfoutput>#pbname#</cfoutput>>
...


The /tmp/FUPSI.cfm contains:
...
<cfdump var=#Form#>

<cfif IsDefined ("Form.Existing_Scenario_wddx")>
<cfwddx action = wddx2cfml input = Form.Existing_Scenario_wddx output = Existing_Scenario>
</cfif>
...


BTW, the value=<cfoutput>#ES_wddx#</cfoutput>
Actually spills the contents of ES_wddx to the screen and not to the hidden variable.

Can anyone shed some light what is going wrong? What I should be doing,? etc.?

Thanks,
Mike
    This topic has been closed for replies.

    1 reply

    fipperAuthor
    Participant
    July 7, 2006
    Well, after a few hours, I finally found a syntax issue to get my code to work.
    The <input type=hidden.....> code need " " around the value Item. It would not work ' ' or without any quotes. Also, I needed the <cfoutput> tags. If no cfoutput tags, I would just get the variable name with the #s.

    So, the main 3 lines of code that worked are:


    <cfwddx action = wddx2cfml input = #Form.Existing_Scenario_wddx# output = Existing_Scenario>

    <cfwddx action = cfml2wddx input = #Get_Scenario_Status# output = ES_wddx>

    <input type="hidden" name="Existing_Scenario_wddx" value="<cfoutput>#ES_wddx#</cfoutput>">



    FYI -- Placing quotes around the action items also caused an error. I could only get it to work without the quotes.

    If anyone has info why the no quotes or why the duoble qoutes but not single quotes, I would like to hear. I am new to coldfusion and still find some confusion when I need/dont need single or double quotes.

    Thanks,
    Mike