The cftree
tag lets you 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 cfform
action
attribute:
To return the root part of the path, set the completepath
attribute of the cftree
tag to Yes; otherwise, the path value starts with the first node. If you specify a root name for a tree item using the queryasroot
tag, that value is returned as the root. If you do not specify a root name, ColdFusion returns the query name as the root. If there is no query name, ColdFusion returns the tree name as the root.
In the previous example, if the user selects the name "John Allen" in the tree, ColdFusion returns the following form variables:
Form.tree1.path = 3\John Allen Form.tree1.node = John Allen
The deptquery root does not appear in the path, because the cftree
tag does not specify completePath=
"Yes
". You can specify the character used to delimit each element of the path form variable in the cftree
delimiter
attribute. The default is a backslash character (\).