132
Developing Web Applications with ColdFusion
•
form.treename.path — Returns the complete path of the user selection, in the
form: root\node1\node2\node_n\value
The root part of the path is only returned if you set the COMPLETEPATH attribute tof
CFTREE to YES; otherwise, the path value starts with the first node.
In the previous example, if the user selects the name "John Allen" in this tree, the
following form variables are returned by ColdFusion:
form.tree1.node = John Allen
form.tree1.path = Department_ID\3\John Allen
You can specify the backslash character used to delimit each element of the path form
variable in the CFTREE DELIMITER attribute.
Input validation
Although, the CFTREE does not include a VALIDATE attribute, you can use the
REQUIRED attribute to force a user to select an item from the tree control. In addition,
you can use the ONVALIDATE attribute to specify the JavaScript code to perform
validation.
Structuring Tree Controls
Tree controls built with CFTREE can be very complex. Knowing how to specify the
relationship between multiple CFTREEITEM entries will help you handle even the
most labyrinthine of CFTREE constructs.
Note
The following tree examples all use the result set from folllowing query.
To run any of the tree examples, insert the query into your test template:
<!--- CFQUERY with an ORDER BY clause --->
<CFQUERY NAME="deptquery" DATASOURCE="CompanyInfo">
SELECT Department_ID, Fir ’ ’ + LastName
AS FullName
FROM EMPLOYEES
ORDER BY Department_ID
</CFQUERY>
Example: One-level tree control
This example consists of a single root and a number of individual items:
<CFFORM NAME="form1" ACTION="submit.cfm">
<CFTREE NAME="tree1">
<CFTREEITEM VALUE="FullName"
QUERY="deptquery"
QUERYASROOT="Department">
</CFTREE>
<BR><INPUT TYPE="submit" VALUE="Submit">
</CFFORM>
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...