Chapter 10: Building Dynamic Forms
Code Review
Code
<SCRIPT>
<!--
function testbox(form) {
Ctrl = form.inputbox1;
if (Ctrl.value == "" || Ctrl.value.indexOf
('@', 0) == -1) {
return (false);
} else
}
//-->
</SCRIPT>
ONVALIDATE="testbox"
See the following Web site for information on JavaScript validation scripts:
http://www.dannyg.com/javascript
Building Tree Controls with CFTREE
The CFTREE form lets you display hierarchical information in a space-saving
collapsible tree populated from data source queries. To build a tree control with
CFTREE, you use individual CFTREEITEM tags to populate the control. You can specify
one of six built-in icons to represent individual items in the tree control.
To create and populate a tree control from a query:
1.
Open a new file named
2.
Modify the page so that it appears as follows:
<CFQUERY NAME="engquery" DATASOURCE="CompanyInfo">
</CFQUERY>
<CFFORM NAME="form1" ACTION="submit.cfm"
4
<CFTREE NAME="tree1"
4
REQUIRED="yes"
4
HSCROLL="no"
4
VSCROLL="yes">
4
<CFTREEITEM VALUE=FullName
return (true);
tree1.cfm
SELECT FirstName + ' ' + LastName AS FullName
FROM EMPLOYEES
METHOD="Post">
Description
JavaScript code to test for
valid entry in text box.
Text box control
parameter that calls the
JavaScript test.
in Studio.
129