Chapter 10: Building Dynamic Forms
131
<!--- Build the tree control --->
<CFFORM NAME="form1" ACTION="submit.cfm"
METHOD="Post">
<CFTREE NAME="tree1"
HSCROLL="no"
VSCROLL="no"
BORDER="yes"
HEIGHT="350"
REQUIRED="yes">
<CFTREEITEM VALUE="Department_ID, FullName"
QUERY="deptquery"
QUERYASROOT="Department_ID"
IMG="cd,folder">
</CFTREE>
<BR><INPUT TYPE="Submit" VALUE="Submit">
</CFFORM>
3.
Save the page and view it in your browser.
Code Review
Note that the comma-separated items in the IMG and the VALUE attributes
correspond. If you leave out the IMG attribute, ColdFusion uses the folder image for all
levels in the tree.
CFTREE form variables
The CFTREE tag allows you to force a user to select an item from the tree control by
setting the REQUIRED attribute to YES. With or without the REQUIRED attribute,
ColdFusion passes two form variables to the application page specified in the CFTREE
ACTION attribute:
•
form.treename.node — Returns the node of the user selection.
Code
Description
ORDER BY Department_ID
Order the query results by department.
<CFTREEITEM
VALUE="Department_ID, FullName"
Popluate the tree with the Department ID, and
under each department, the Full Name for each
employee in the department
QUERYASROOT="Department_ID"
Make the Department ID the root of the tree
IMG="cd,folder">
Use the ColdFusion-supplied images CD and
Folder.
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...