User Guide
350 Chapter 2: ColdFusion Tags
Usage
This tag requires the client to download a Java applet. Downloading an applet takes time;
therefore, using this tag might be slightly slower than using an HTML form element or the
cfinput tag to get the same information.
For this tag to work properly. the browser must be JavaScript-enabled.
Example
<!--- This example shows the use of cftreeitem in cfform. Query takes
employee list, and uses cftree and cfselect to display query results.
Shows an alternate means of displaying the data --->
<!--- set a default for the employeeNames variable --->
<cfparam name = "employeeNames" default = "">
<!--- if an employee name has been passed from the form, set employeeNames
variable to this value ---Auto>
<cfif IsDefined("form.employeeNames")>
<cfset employeeNames = form.employeeNames>
</cfif>
<!--- query the datasource to find the employee information--->
<cfquery name = "GetEmployees" dataSource = "cfsnippets">
SELECT Emp_ID, FirstName, LastName, EMail, Phone, Department
FROM Employees
WHERE 0=0
<cfif employeeNames is not "">
AND LastName = '#employeeNames#'
</cfif>
</cfquery>
<!--- Use cfform when using other cfinput tools --->
<cfform action = "cfindex.cfm">
imgopen Optional Icon displayed with open tree item. You can specify icon
filename with a relative path. You can use a ColdFusion image.
href Optional URL to associate with tree item or query column for a tree that
is populated from a query. If
href is a query column, its value is
the value populated by query. If href is not recognized as a
query column, it is assumed that its text is an HTML href.
When populating a tree with data from a query, HREFs can be
specified in delimited list; for example:
href = "http://dept_svr,http://emp_svr"
target Optional Target attribute of href URL. When populating a tree with data
from a query, specify target in delimited list:
target = "FRAME_BODY,_blank"
query Optional Query name to generate data for the treeitem.
queryAsRoot Optional Defines query as the root level. This avoids having to create
another parent cftreeitem.
• Yes
• No
• String to use as the root name
If you do not specify a root name, ColdFusion returns the query
name as the root.
expand Optional Yes • Yes: expands tree to show tree item children
• No: keeps tree item collapsed
Attribute Req/Opt Default Description