Input Validation; Structuring Tree Controls - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

132
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
<!--- CFQUERY with an ORDER BY clause --->
<CFQUERY NAME="deptquery" DATASOURCE="CompanyInfo">
SELECT Department_ID, FirstName + ' ' + 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">
</CFTREE>
<BR><INPUT TYPE="submit" VALUE="Submit">
</CFFORM>
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:
<CFTREEITEM VALUE="FullName"
QUERY="deptquery"
QUERYASROOT="Department">
Developing Web Applications with ColdFusion

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 4.5

Table of Contents