[thelist] Coldfusion: getting javascript variables

ted serbinski tss24 at cornell.edu
Tue Jan 8 21:46:49 CST 2002


> 
> ok, i noticed a few javascript things that need some 
> attention when you have the chance.  you're unnecessarily 
> using the eval() method all over the place.  this will impact 
> the performance of your script.  i would remove every instance.
> 

It seems I thought I needed those to get it evaluate a variable + a
string for a dynamic name. Guess not.
> 
> it looks to me like maybe you should take a look at wddx.  
> use that to convert your javascript associative arrays into a 
> wddx packet, stuff that in a form field, and submit it to the 
> coldfusion page.  then, use <cfwddx action="wddx2cfml"> to 
> convert it to coldfusion, walk through the structures saving 
> the data in a text file or database.
> 

Hmmm, having trouble with this part. I was able to convert my arrays
into a WDDX packet on the page, showing this fine. But when I send this
via a form and output this data, I get no ouptut.

This is my code I'm using for output:

<cfoutput>
<textarea name="packet" rows=8 cols=50>#Form.packet#</textarea>
</cfoutput>

<cfwddx action="wddx2cfml" input="#Form.packet#"
output="deserializedCode">
<cfloop list="#deserializedCode.ColumnList#" index="ThisField">
<cfoutput>
#ThisField#: #Evaluate("deserializedCode." & ThisField)# <br>
</cfoutput>
</cfloop>

All this displays is #Form.packet# and all my other variables, without
actually evaluating there values. Any ideas? I'm sending my data from
this form:

/javascript
	document.generateCF.packet.value= WDDXPacket;
	document.generateCF.submit();

/html

<form name="generateCF" method="post" action="generateMenu.cfm">
<input type="hidden" name="packet">
</form>

When I alert my form value above, I get the correct WDDX format layout,
so I know I have the data correct.

Also, the structure layout that was mentioned, this is just the best way
to save my data from above, if I get it to display right?

Thanks again, greatly helping

ted






More information about the thelist mailing list