cftree

Inserts a tree control in a form. Validates user selections.
Used within a cftree tag block. You can use a CFML query
to supply data to the tree.

  <cftree name="">

 cftree(name="");

The cftree tag is DEPRECATED as of ColdFusion 11

Discouraged: The use of tags generating UI is generally discouraged by the CFML community. See: https://static.raymondcamden.com/cfuitherightway/cftree/index.html

Attribute Reference

name string
Required

Name for tree control.

format string
Default: applet

- applet: displays the tree using a Java applet in the
browser,
- flash: displays the tree using a Flash control
- object: returns the tree as a ColdFusion structure with the
name specified by the name attribute, For details of the
structure contents, see "object format", below.
- xml: Generates an XMLrepresentation of the tree.
In XML format forms, includes the generated XML in the
form. and puts the XML in a string variable with the name
specified by the name attribute.
Default: applet
Values:
  • applet
  • flash
  • html
  • object
  • xml

required boolean
Default: false

- true: user must select an item in tree control
- false: they do not
Default: false
Values:
  • true
  • false

delimiter string
Default: \\

Character to separate elements in form variable path.
Default: \\

completepath boolean
Default: false

- true: start the Form.treename.path variable with the root
of the tree path when cftree is submitted.
- false: omit the root level from the Form.treename.path
variable; the value starts with the first child node in the
tree.
For the preserveData attribute of cfform to work with the
tree, you must set this attribute to Yes.
For tree items populated by a query, if you use the
cftreeitem queryasroot attribute to specify a root name,
that value is returned. If you do not specify a root name,
ColdFusion returns the query name.
Default: false
Values:
  • true
  • false

appendkey boolean
Default: true

- true: if you use cftreeitem href attributes, ColdFusion
appends a CFTREEITEMKEY query string variable with
the value of the selected tree item to the cfform action URL.
- false: do not append the tree item value to the URL.
Default: true
Values:
  • true
  • false

highlighthref boolean
Default: true

- true: highlights as a link the displayed value for any
cftreeitem tag that specifies a href attribute.
- false: disables highlighting.
Default: true
Values:
  • true
  • false

onvalidate string

JavaScript function to validate user input. The form object,
input object, and input object value are passed to the
specified routine, which should return True if validation
succeeds; False, otherwise.

message string

Message to display if validation fails.

onerror string

JavaScript function to execute if validation fails.

lookandfeel string
Default: windows

- motif: renders slider in Motif style
- windows: renders slider in Windows style
- metal: renders slider in Java Swing style
If platform does not support style option, tag defaults to
platform default style.
Default: windows
Values:
  • motif
  • windows
  • metal

font string
Default: arial

Font name for data in tree control.
Values:
  • arial
  • times
  • courier
  • arialunicodeMS

fontsize numeric

Font size for text in tree control, in points.

italic boolean
Default: false

- true: displays tree control text in italics
- false: it does not
Default: false
Values:
  • true
  • false

bold boolean
Default: false

- true: displays tree control text in bold
- false: it does not
Default: false
Values:
  • true
  • false

height numeric
Default: 320

Tree control height, in pixels. If you omit this attribute in
Flash format, Flash automatically sizes the tree.
Default: 320 (applet only)

width numeric
Default: 200

Tree control width, in pixels. If you omit this attribute in
Flash format, Flash automatically sizes the tree.
Default: 200 (applet only)

vspace numeric

Vertical margin above and below tree control, in pixels.

hspace numeric

Horizontal spacing to left and right of tree control, in pixels.

align string

Alignment of the tree control applet object.
Values:
  • top
  • left
  • bottom
  • baseline
  • texttop
  • absbottom
  • middle
  • absmiddle
  • right

border boolean
Default: true

- true: display a border around the tree control.
- false: no border
Default: true
Values:
  • true
  • false

hscroll boolean
Default: true

- true: permits horizontal scrolling
- false: no horizontal scrolling
Default: true
Values:
  • true
  • false

vscroll boolean
Default: true

- true: permits vertical scrolling
- false: no vertical scrolling
Default: true
Values:
  • true
  • false

style string

Flash only: Must be a style specification in CSS format, with the same
syntax and contents as used in Macromedia Flex for the
corresponding Flash element.

enabled boolean
Default: true

Flash only: Boolean value specifying whether the
control is enabled. A disabled control appears in light gray.
Default: true
Values:
  • true
  • false

visible boolean
Default: true

Flash only: Boolean value specifying whether to
show the control. Space that would be occupied by an
invisible control is blank.
Default: true
Values:
  • true
  • false

tooltip string

Flash only: Text to display when the mouse pointer
hovers over the control.

onchange string

Flash only: ActionScript to run when the control changes due to user action.
If you specify an onChange event handler, the Form scope of
the ColdFusion action page does not automatically get
information about selected items. The ActionScript onChange
event handler must handle all changes and selections.

onblur string

Flash only: ActionScript that runs when the calendar loses focus.
(Added in 7.0.1)

onfocus string

Flash only: ActionScript that runs when the calendar loses focus.
(Added in 7.0.1)

notsupported string
Default: <b>Browser must support Java to <br>view ColdFusion Java Applets!</b>

Text to display if a page that contains a Java applet-based
cfform control is opened by a browser that does not
support Java or has Java support disabled.

cache boolean
Default: true

A Boolean value that specifies whether to get new data each time the user expands tree nodes, as follows:
* yes: fetches a node's child items only once, when the node is first expanded
* no: fetches child items each time the node is expanded.
Values:
  • true
  • false

Compatibility

ColdFusion:

DEPRECATED since version 11

Examples
Sample code using the cftree tag

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub