MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual page 371

Table of Contents

Advertisement

Transferring Data from Browser to Server
</script>
<!--- Data collection form --->
<form action="wddx_browser_2_server.cfm" method="Post"
name="personForm">
// Person info record set with columns firstName and lastName
// Make sure the case of field names is preserved
var personInfo = new WddxRecordset(new Array("firstName",
"lastName"), true);
// Add next record to end of personInfo record set
function doNext()
{
// Extract data
var firstName = document.personForm.firstName.value;
var lastName = document.personForm.lastName.value;
// Add names to record set
nRows = personInfo.getRowCount();
personInfo.firstName[nRows] = firstName;
personInfo.lastName[nRows] = lastName;
// Clear input fields
document.personForm.firstName.value = "";
document.personForm.lastName.value = "";
// Show added names on list
// This gets a little tricky because of browser differences
var newName = firstName + " " + lastName;
if (navigator.appVersion.indexOf("MSIE") == -1)
{
document.personForm.names[length] =
new Option(newName, "", false, false);
}
else
{
// IE version
var entry = document.createElement("OPTION");
entry.text = newName;
document.personForm.names.add(entry);
}
}
<!--- Input fields --->
Personal information<p>
First name: <input type=text name=firstName><BR>
Last name: <input type=text name=lastName><BR>
<p>
351

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 5

Table of Contents