246
Developing Web Applications with ColdFusion
<!--- Dump the recordset --->
q.dump(true);
</SCRIPT>
Note
To see how CFWDDX Action="cfml2js" works, view the source to the
page.
Transferring Data From Browser to Server
This example serializes form field data, posts it to the server, deserializes it, and
outputs the data. For simplicity, only a small amount of data is collected. In
applications where complex JavaScript data collections are generated, this basic
approach can be extended very effectively.
<!--- Get WDDX JS utility objects --->
<SCRIPT LANGUAGE="JavaScript"
SRC="/CFIDE/scripts/wddx.js"></SCRIPT>
<!--- Add data binding code --->
<SCRIPT>
// Generic serialization to a form field
function serializeData(data, formField)
{
wddxSerializer = new WddxSerializer();
wddxPacket = wddxSerializer.serialize(data);
if (wddxPacket != null)
{
formField.value = wddxPacket;
}
else
{
alert("Couldn’t serialize data");
}
}
// Person info recordset with columns firstName and lastName
var personInfo = new WddxRecordset(new Array("firstName",
"lastName"));
// Add next record to end of personInfo recordset
function doNext()
{
nRows = personInfo.getRowCount();
personInfo.firstName[nRows] =
document.personForm.firstName.value;
personInfo.lastName[nRows] = document.personForm.lastName.value;
document.personForm.firstName.value = "";
document.personForm.lastName.value = "";
}
Summary of Contents for COLDFUSION 4.5-DEVELOPING WEB
Page 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Page 14: ...xiv Developing Web Applications with ColdFusion...
Page 26: ...xxvi Developing Web Applications with ColdFusion...
Page 34: ...8 Developing Web Applications with ColdFusion...
Page 70: ...44 Developing Web Applications with ColdFusion...
Page 84: ...58 Developing Web Applications with ColdFusion...
Page 114: ...88 Developing Web Applications with ColdFusion...
Page 148: ...122 Developing Web Applications with ColdFusion...
Page 174: ...148 Developing Web Applications with ColdFusion...
Page 208: ...182 Developing Web Applications with ColdFusion...
Page 244: ...218 Developing Web Applications with ColdFusion...
Page 274: ...248 Developing Web Applications with ColdFusion...
Page 288: ...262 Developing Web Applications with ColdFusion...
Page 300: ...274 Developing Web Applications with ColdFusion...
Page 350: ...324 Developing Web Applications with ColdFusion...
Page 362: ...336 Developing Web Applications with ColdFusion...