
773
DEVELOPING
COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
Las
t
upda
te
d 8/5/2010
<cfif IsDefined("Form.fieldnames")>
<cfdump var="#form#" label="form scope">
<br><br>
</cfif>
<cfscript>
q1 = queryNew("id,firstname,lastname");
queryAddRow(q1);
querySetCell(q1, "id", "1");
querySetCell(q1, "firstname", "Rob");
querySetCell(q1, "lastname", "Smith");
queryAddRow(q1);
querySetCell(q1, "id", "2");
querySetCell(q1, "firstname", "John");
querySetCell(q1, "lastname", "Doe");
queryAddRow(q1);
querySetCell(q1, "id", "3");
querySetCell(q1, "firstname", "Jane");
querySetCell(q1, "lastname", "Doe");
queryAddRow(q1);
querySetCell(q1, "id", "4");
querySetCell(q1, "firstname", "Erik");
querySetCell(q1, "lastname", "Pramenter");
</cfscript>
<cfform name="form1" format="flash" height="220" width="450">
<cfselect label="select a teacher" name="sel1" query="q1" value="id"
display="firstname" width="100" />
<cfformgroup type="repeater" query="q1">
<cfformgroup type="horizontal" label="name">
<cfinput type="Text" name="fname"bind="{q1.currentItem.firstname}">
<cfinput type="Text" name="lname" bind="{q1.currentItem.lastname}">
</cfformgroup>
</cfformgroup>
<cfinput type="submit" name="submitBtn" value="Send Data" width="100">
</cfform>
Creating complex forms with accordion and tab navigator containers
The
accordion
and
tabnavigator
attributes of the
cfformgroup
tag let you construct complex forms that would
otherwise require multiple HTML pages. With accordions and tab navigator containers, users can switch among
multiple entry areas without submitting intermediate forms. All data that they enter is available until they submit the
form, and all form elements load at one time.