- CFML Reference User Guide
- ColdFusion functions
- ColdFusion functions by category
- Functions a-b
- Abs
- ACos
- AddSOAPRequestHeader
- AddSOAPResponseHeader
- AjaxLink
- AjaxOnLoad
- ApplicationStop
- ArrayAppend
- ArrayAvg
- ArrayClear
- ArrayContains
- ArrayContainsNoCase
- ArrayDelete
- ArrayDeleteAt
- ArrayDeleteNoCase
- ArrayEach
- ArrayFilter
- ArrayFind
- ArrayFindAll
- ArrayFindAllNoCase
- ArrayFindNoCase
- ArrayInsertAt
- ArrayIsDefined
- ArrayIsEmpty
- ArrayLen
- ArrayMap
- ArrayMax
- ArrayMin
- ArrayNew
- ArrayPrepend
- ArrayReduce
- ArrayResize
- ArraySet
- ArraySetMetadata
- ArraySlice
- ArraySort
- ArraySum
- ArraySwap
- ArrayToList
- Asc
- ASin
- Atn
- AuthenticatedContext
- AuthenticatedUser
- BinaryDecode
- BinaryEncode
- BitAnd
- BitMaskClear
- BitMaskRead
- BitMaskSet
- BitNot
- BitOr
- BitSHLN
- BitSHRN
- BitXor
- BooleanFormat
- Abs
- Functions-c-d
- CacheGet
- CacheGetAllIds
- CacheGetMetadata
- CacheGetProperties
- CacheGetSession
- CacheIdExists
- CachePut
- CacheRegionExists
- CacheRegionNew
- CacheRegionRemove
- CacheRemove
- CacheRemoveAll
- CacheSetProperties
- CallStackDump
- CallStackGet
- CanDeSerialize
- Canonicalize
- CanSerialize
- Ceiling
- CharsetDecode
- CharsetEncode
- Chr
- CJustify
- Compare
- CompareNoCase
- Cos
- CreateDate
- CreateDateTime
- CreateObject
- CreateObject: .NET object
- CreateObject: COM object
- CreateObject: component object
- CreateObject: CORBA object
- CreateObject: Java or EJB object
- CreateObject: web service object
- CreateODBCDate
- CreateODBCDateTime
- CreateODBCTime
- CreateSignedJWT
- CreateEncryptedJWT
- CreateTime
- CreateTimeSpan
- CreateUUID
- CSRFGenerateToken
- CSRFVerifyToken
- DateAdd
- DateCompare
- DateConvert
- DateDiff
- DateFormat
- DatePart
- DateTimeFormat
- Day
- DayOfWeek
- DayOfWeekAsString
- DayOfYear
- DaysInMonth
- DaysInYear
- DE
- DecimalFormat
- DecodeForHTML
- DecodeFromURL
- DecrementValue
- Decrypt
- DecryptBinary
- DeleteClientVariable
- Deserialize
- DeserializeJSON
- DeserializeXML
- DirectoryCopy
- DirectoryCreate
- DirectoryDelete
- DirectoryExists
- DirectoryList
- DirectoryRename
- DollarFormat
- DotNetToCFType
- Duplicate
- Functions-e-g
- EncodeForCSS
- EncodeForDN
- EncodeForHTML
- EncodeForHTMLAttribute
- EncodeForJavaScript
- EncodeForLDAP
- EncodeForURL
- EncodeForXML
- EncodeForXMLAttribute
- EncodeForXpath
- Encrypt
- EncryptBinary
- EntityDelete
- EntityLoad
- EntityLoadByExample
- EntityLoadByPK
- EntityMerge
- EntityNew
- EntityReload
- EntitySave
- EntityToQuery
- Evaluate
- Exp
- ExpandPath
- FileClose
- FileCopy
- FileDelete
- FileExists
- FileGetMimeType
- FileIsEOF
- FileMove
- FileOpen
- FileRead
- FileReadBinary
- FileReadLine
- FileSeek
- FileSetAccessMode
- FileSetAttribute
- FileSetLastModified
- FileSkipBytes
- FileUpload
- FileUploadAll
- FileWrite
- FileWriteLine
- Find
- FindNoCase
- FindOneOf
- FirstDayOfMonth
- Fix
- Floor
- FormatBaseN
- GeneratePBKDFKey
- GenerateSecretKey
- GetApplicationMetadata
- GetAuthUser
- GetBaseTagData
- GetBaseTagList
- GetBaseTemplatePath
- GetClientVariablesList
- GetComponentMetaData
- GetContextRoot
- GetCPUUsage
- GetCurrentTemplatePath
- GetDirectoryFromPath
- GetEncoding
- GetException
- GetFileFromPath
- GetFileInfo
- GetFreeSpace
- GetFunctionCalledName
- GetFunctionList
- GetGatewayHelper
- GetHttpRequestData
- GetHttpTimeString
- GetK2ServerDocCount
- GetK2ServerDocCountLimit
- GetLocale
- GetLocaleDisplayName
- GetLocalHostIP
- GetMetaData
- GetMetricData
- GetPageContext
- GetPrinterInfo
- GetPrinterList
- GetProfileSections
- GetProfileString
- GetReadableImageFormats
- GetSafeHTML
- GetSAMLAuthRequest
- GetSAMLLogoutRequest
- GenerateSAMLSPMetadata
- GetSOAPRequest
- GetSOAPRequestHeader
- GetSOAPResponse
- GetSOAPResponseHeader
- GetSystemFreeMemory
- GetSystemTotalMemory
- GetTempDirectory
- GetTempFile
- GetTemplatePath
- GetTickCount
- GetTimeZoneInfo
- GetToken
- GetTotalSpace
- GetUserRoles
- GetVFSMetaData
- GetWriteableImageFormats
- Functions-h-im
- Hash
- HMac
- Hour
- HQLMethods
- HTMLCodeFormat
- HTMLEditFormat
- IIf
- ImageAddBorder
- ImageBlur
- ImageClearRect
- ImageCopy
- ImageCreateCaptcha
- ImageCrop
- ImageDrawArc
- ImageDrawBeveledRect
- ImageDrawCubicCurve
- ImageDrawLine
- ImageDrawLines
- ImageDrawOval
- ImageDrawPoint
- ImageDrawQuadraticCurve
- ImageDrawRect
- ImageDrawRoundRect
- ImageDrawText
- ImageFlip
- ImageGetBlob
- ImageGetBufferedImage
- ImageGetEXIFMetadata
- ImageGetEXIFTag
- ImageGetHeight
- ImageGetIPTCMetadata
- ImageGetIPTCTag
- ImageGetMetadata
- ImageGetWidth
- ImageGrayscale
- ImageInfo
- ImageMakeColorTransparent
- ImageMakeTranslucent
- ImageNegative
- ImageNew
- ImageOverlay
- ImagePaste
- ImageRead
- ImageReadBase64
- ImageResize
- ImageRotate
- ImageRotateDrawingAxis
- ImageScaleToFit
- ImageSetAntialiasing
- ImageSetBackgroundColor
- ImageSetDrawingColor
- ImageSetDrawingStroke
- ImageSetDrawingTransparency
- ImageSharpen
- ImageShear
- ImageShearDrawingAxis
- ImageTranslate
- ImageTranslateDrawingAxis
- ImageWrite
- ImageWriteBase64
- ImageXORDrawingMode
- Functions-in-k
- IncrementValue
- InputBaseN
- Insert
- Int
- InvalidateOauthAccesstoken
- Invoke
- InitSAMLAuthRequest
- InitSAMLLogoutRequest
- InvokeCFClientFunction
- IsArray
- IsAuthenticated
- IsAuthorized
- IsBinary
- IsBoolean
- IsClosure
- IsCustomFunction
- IsDate
- IsDateObject
- IsDDX
- IsDebugMode
- IsDefined
- IsImage
- IsImageFile
- IsInstanceOf
- IsIPv6
- IsJSON
- IsK2ServerABroker
- IsK2ServerDocCountExceeded
- IsK2ServerOnline
- IsLeapYear
- IsLocalHost
- IsNull
- IsNumeric
- IsNumericDate
- IsObject
- isOnline
- IsPDFArchive
- IsPDFFile
- IsPDFObject
- IsProtected
- IsQuery
- isSamlLogoutResponse
- isSafeHTML
- IsSimpleValue
- IsSOAPRequest
- IsSpreadsheetFile
- IsSpreadsheetObject
- IsStruct
- IsUserInAnyRole
- IsUserInRole
- IsUserLoggedIn
- IsValid
- IsValidOauthAccesstoken
- IsWDDX
- IsXML
- IsXmlAttribute
- IsXmlDoc
- IsXmlElem
- IsXmlNode
- IsXmlRoot
- JavaCast
- JSStringFormat
- Functions-l
- LCase
- Left
- Len
- ListAppend
- ListChangeDelims
- ListContains
- ListContainsNoCase
- ListDeleteAt
- ListEach
- ListFilter
- ListFind
- ListFindNoCase
- ListFirst
- ListGetAt
- ListInsertAt
- ListLast
- ListLen
- ListMap
- ListPrepend
- ListQualify
- ListReduce
- ListRemoveDuplicates
- ListRest
- ListSetAt
- ListSort
- ListToArray
- ListValueCount
- ListValueCountNoCase
- LJustify
- Location
- Log
- Log10
- LSCurrencyFormat
- LSDateFormat
- LSDateTimeFormat
- LSEuroCurrencyFormat
- LSIsCurrency
- LSIsDate
- LSIsNumeric
- LSNumberFormat
- LSParseCurrency
- LSParseDateTime
- LSParseEuroCurrency
- LSParseNumber
- LSTimeFormat
- LTrim
- Functions-m-r
- Max
- Mid
- Min
- Minute
- Month
- MonthAsString
- Now
- NumberFormat
- ObjectEquals
- ObjectLoad
- ObjectSave
- OnWSAuthenticate
- ORMClearSession
- ORMCloseAllSessions
- ORMCloseSession
- ORMEvictCollection
- ORMEvictEntity
- ORMEvictQueries
- ORMExecuteQuery
- ORMFlush
- ORMFlushall
- ORMGetSession
- ORMGetSessionFactory
- ORMIndex
- ORMIndexPurge
- ORMReload
- ORMSearch
- ORMSearchOffline
- ParagraphFormat
- ParameterExists
- ParseDateTime
- Pi
- PrecisionEvaluate
- ProcessSAMLResponse
- ProcessSAMLLogoutRequest
- Quarter
- PreserveSingleQuotes
- QueryAddColumn
- QueryAddRow
- QueryConvertForGrid
- QueryExecute
- QueryFilter
- QueryGetResult
- QueryGetRow
- QueryKeyExists
- QueryMap
- QueryNew
- QueryReduce
- QuerySetCell
- QuotedValueList
- QueryEach
- Rand
- Randomize
- RandRange
- ReEscape
- REFind
- REFindNoCase
- ReleaseComObject
- REMatch
- REMatchNoCase
- RemoveCachedQuery
- RemoveChars
- RepeatString
- Replace
- ReplaceList
- ReplaceNoCase
- REReplace
- REReplaceNoCase
- RestDeleteApplication
- RestSetResponse
- RestInitApplication
- Reverse
- Right
- RJustify
- Round
- RTrim
- Functions-s
- Second
- SendGatewayMessage
- SendSAMLLogoutResponse
- Serialize
- SerializeJSON
- SerializeXML
- SessionInvalidate
- SessionRotate
- SessionGetMetaData
- SessionInvalidate
- SessionRotate
- SetDay
- SetEncoding
- SetHour
- SetLocale
- SetMonth
- SetProfileString
- SetVariable
- SetYear
- Sgn
- Sin
- Sleep
- SpanExcluding
- SpanIncluding
- SpreadsheetAddAutoFilter
- SpreadsheetAddColumn
- SpreadsheetAddFreezePane
- SpreadsheetAddImage
- SpreadsheetAddInfo
- SpreadsheetAddPageBreaks
- SpreadsheetAddRow
- SpreadsheetAddRows
- SpreadsheetAddSplitPane
- SpreadsheetCreateSheet
- SpreadsheetDeleteColumn
- SpreadsheetDeleteColumns
- SpreadsheetDeleteRow
- SpreadsheetDeleteRows
- SpreadsheetFormatCell
- SpreadsheetFormatColumn
- SpreadsheetFormatCellRange
- SpreadsheetFormatColumn
- SpreadsheetFormatColumns
- SpreadsheetFormatRow
- SpreadsheetFormatRows
- SpreadsheetGetCellComment
- SpreadsheetGetCellFormula
- SpreadsheetGetCellValue
- SpreadsheetGetColumnCount
- SpreadsheetInfo
- SpreadsheetMergeCells
- SpreadsheetNew
- SpreadsheetRead
- SpreadsheetReadBinary
- SpreadsheetRemoveSheet
- SpreadsheetSetActiveSheet
- SpreadsheetSetActiveSheetNumber
- SpreadsheetSetCellComment
- SpreadsheetSetCellFormula
- SpreadsheetSetCellValue
- SpreadsheetSetColumnWidth
- SpreadsheetSetFooter
- SpreadsheetSetHeader
- SpreadsheetSetRowHeight
- SpreadsheetShiftColumns
- SpreadsheetShiftRows
- SpreadsheetWrite
- Sqr
- StripCR
- StructAppend
- StructClear
- StructCopy
- StructCount
- StructDelete
- StructEach
- StructFilter
- StructFind
- StructFindKey
- StructFindValue
- StructGet
- StructGetMetadata
- StructInsert
- StructIsEmpty
- StructKeyArray
- StructKeyExists
- StructKeyList
- StructMap
- StructNew
- StructReduce
- StructSetMetadata
- StructSort
- StructToSorted
- StructUpdate
- StoreSetMetadata
- StoreGetACL
- StoreGetMetadata
- StoreAddACL
- StoreSetACL
- Functions-t-z
- Tan
- ThreadJoin
- ThreadTerminate
- Throw
- TimeFormat
- ToBase64
- ToBinary
- ToScript
- ToString
- Trace
- Transactionandconcurrency
- TransactionCommit
- TransactionRollback
- TransactionSetSavePoint
- Trim
- UCase
- URLDecode
- URLEncodedFormat
- URLSessionFormat
- Val
- ValueList
- VerifyClient
- Week
- Wrap
- WriteDump
- WriteLog
- WriteOutput
- WSGetAllChannels
- WSGetSubscribers
- WSPublish
- WSSendMessage
- XmlChildPos
- XmlElemNew
- XmlFormat
- XmlGetNodeType
- XmlNew
- XmlParse
- XmlSearch
- XmlTransform
- XmlValidate
- Year
- YesNoFormat
- ColdFusion Tags
- ColdFusion tag summary
- ColdFusion tags by category
- Application framework tags
- Communications tags
- Database manipulation tags
- Data output tags
- Debugging tags
- Exception handling tags
- Extensibility tags
- File management tags
- Flow-control tags
- Forms tags
- Internet Protocol tags
- Page processing tags
- Security tags
- Variable manipulation tags
- Other tags
- Tags a-b
- Tags c
- Tags f
- cffeed
- cffile
- cffile action = "append"
- cffile action = "copy"
- cffile action = "delete"
- cffile action = "move"
- cffile action = "read"
- cffile action = "readBinary"
- cffile action = "rename"
- cffile action = "upload"
- cffile action = "uploadAll"
- cffile action = "write"
- cffileupload
- cffinally
- cfflush
- cfform
- cfformgroup
- cfformitem
- cfftp
- cfftp: Connection: file and directory operations
- cfftp: Opening and closing FTP server connections
- cfftp : Opening and closing secure FTP server connections
- cfftp action = "listDir"
- cffunction
- Tags g-h
- Tags i
- Tags j-l
- cfjava
- cflayout
- cflayoutarea
- cfldap
- cflocation
- cflock
- cflog
- cflogin
- cfloginuser
- cflogout
- cfloop
- cfloop : conditional loop
- cfloop : index loop
- cfloop : looping over a COM collection or structure
- cfloop : looping over a date or time range
- cfloop : looping over a list, a file, or an array
- cfloop : looping over a query
- Tags m-o
- cfmail
- cfmailparam
- cfmailpart
- cfmap
- cfmapitem
- cfmediaplayer
- cfmenu
- cfmenuitem
- cfmessagebox
- cfmodule
- cfNTauthenticate
- cfoauth
- cfobject
- cfobject: .NET object
- cfobject: COM object
- cfobject: component object
- cfobject: CORBA object
- cfobject: Java or EJB object
- cfobject: web service object
- cfobjectcache
- cfoutput
- Tags p-q
- Tags r-s
- Tags t
- Tags u-z
- CFML Reference
- Reserved words and variables
- Ajax JavaScript functions
- Ajax JavaScript functions
- Function summary Ajax
- ColdFusion.Ajax.submitForm
- ColdFusion.Autosuggest.getAutosuggestObject
- ColdFusion.Layout.enableSourceBind
- ColdFusion.MessageBox.getMessageBoxObject
- ColdFusion.ProgressBar.getProgressBarObject
- ColdFusion.MessageBox.isMessageBoxDefined
- JavaScriptFunctionsinColdFusion9Update1
- ColdFusion ActionScript functions
- ColdFusion mobile functions
- Application.cfc reference
- Script functions implemented as CFCs
- ColdFusion Flash Form style reference
- Styles valid for all controls
- Styles for cfform
- Styles for cfformgroup with horizontal or vertical type attributes
- Styles for box-style cfformgroup elements
- Styles for cfformgroup with accordion type attribute
- Styles for cfformgroup with tabnavigator type attribute
- Styles for cfformitem with hrule or vrule type attributes
- Styles for cfinput with radio, checkbox, button, image, or submit type attributes
- Styles for cftextarea tag and cfinput with text, password, or hidden type attributes
- Styles for cfselect with size attribute value of 1
- Styles for cfselect with size attribute value greater than 1
- Styles for cfcalendar tag and cfinput with dateField type attribute
- Styles for the cfgrid tag
- Styles for the cftree tag
- ColdFusion Flash Form Style Reference
- ColdFusion event gateway reference
- ColdFusion Event Gateway reference
- addEvent
- CFEvent
- CFEventclass
- Constructor
- Gateway development interfaces and classes
- getStatus
- setCFCPath
- setCFCMethod
- getOriginatorID
- getLogger
- getBuddyList
- getBuddyInfo
- IM gateway message sending commands
- IM Gateway GatewayHelper class methods
- onIncomingMessage
- onIMServerMessage
- onBuddyStatus
- onAddBuddyResponse
- onAddBuddyRequest
- IM Gateway CFC incoming message methods
- IM gateway methods and commands
- CFML CFEvent structure
- warn
- info
- setOriginatorID
- data command
- submit Multi command
- submit command
- setGatewayType
- setGatewayID
- setData
- setCFCListeners
- outgoingMessage
- getStatusTimeStamp
- numberOfMessagesReceived
- numberOfMessagesSent
- removeBuddy
- removeDeny
- removePermit
- setNickName
- setPermitMode
- setStatus
- SMS Gateway CFEvent structure and commands
- SMS Gateway incoming message CFEvent structure
- getStatusAsString
- getProtocolName
- getPermitMode
- getPermitList
- getNickName
- getName
- getDenyList
- getCustomAwayMessage
- getQueueSize
- getMaxQueueSize
- getHelper
- getGatewayType
- getGatewayServices
- getGatewayID_1
- getGatewayID
- getData
- getCFCTimeout
- setCFCTimeout
- getCFCPath
- getCFCMethod
- GatewayServices class
- Gateway interface
- GatewayHelper interface
- addPermit
- addDeny
- addBuddy
- error
- debug
- Logger class
- stop
- start
- CFML event gateway SendGatewayMessage data parameter
- restart
- fatal
- SMS gateway message sending commands
- ColdFusion C++ CFX Reference
- ColdFusion Java CFX reference
- WDDX JavaScript Objects
- Cloud services
- ColdFusion and GCP Storage
- ColdFusion and GCP Firestore
- ColdFusion and GCP PubSub
- ColdFusion and Amazon S3
- ColdFusion and DynamoDB
- ColdFusion and Amazon SQS
- ColdFusion and Amazon SNS
- ColdFusion and MongoDB
- ColdFusion and Azure Blob
- ColdFusion and Azure Service Bus
- Multi-cloud storage services
- Multi-cloud RDS databases
- ColdFusion and Azure Cosmos DB
FORMAT="applet" HAS BEEN DEPRECATED
The UI tags for cftree based on the YUI toolkit have been deprecated.
For a full list of deprecated features, refer to Deprecated features.
Description
Inserts a tree control in a form. Validates user selections. Used within a cfform tag block. Use a ColdFusion query to supply data to the tree.
Category
Syntax
name="name" align="top|left|bottom|baseline|texttop|absbottom| middle|absmiddle|right" appendKey="yes|no" bold="yes|no" border="yes|no" cache="yes|no" completePath="yes|no" delimiter="delimiter" enabled="yes|no" font="font" fontSize="size" format="applet|flash|html|object|xml" height="integer" highlightHref="yes|no" hScroll="yes|no" hSpace="integer" italic="yes|no" lookAndFeel="motif|windows|metal" message="text" notSupported="text"> onBlur="ActionScript to invoke" onChange="ActionScript to invoke" onError="text" onFocus="Actionscript to invoke" onValidate="script name" required="yes|no" style= "style specification" tooltip="text" visible="yes|no" vScroll="yes|no" vSpace="integer" width="integer"> </cftree>
You can specify this tag's attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag's attribute names as structure keys.
See also
cfajaximport, cfapplet, cfcalendar, cfform, cfformgroup, cfformitem, cfgrid, cfinput, cfselect, cfslider, cftextarea,
cftreeitem; Working with action pages ,Building tree controls with the cftree tag ,and Using HTML trees in the Developing ColdFusion Applications
History
ColdFusion 8: Added support for Ajax based HTML trees, including the cache attribute and the html value for format attribute.
ColdFusion MX7.01: Added support for onBlur and onFocus events.
ColdFusion MX 7:
- Added the format attribute and support for generating Flash and XML and object output.
- Added enabled, onChange, style, tooltip, and visible attributes (Flash format only).ColdFusion MX: Changed behavior: ColdFusion renders a tree control regardless of whether there are any treeitems within it.
Attributes
In XML format, ColdFusion passes all attributes to the XML. The supplied XSLT skins do not handle or display XML format trees, but do display applet and Flash format trees.
Attribute |
Req/OptFormat |
Default |
Description |
---|---|---|---|
name |
Required;All |
|
Name for a tree control. |
align |
Optional;Applet, object |
|
|
appendKey |
Optional;All |
yes |
|
bold |
Optional;Applet, Flash, HTML |
no |
|
border |
Optional;Applet, object |
yes |
|
cache |
Optional;HTML |
yes |
Applies only if the tree's child treeitem tag uses a bind expression. A Boolean value that specifies whether to get new data each time the user expands tree nodes, as follows:
|
completePath |
Optional;Applet, HTML, object |
no |
|
delimiter |
Optional;All |
{{\\\\}} |
Character to separate elements in the Forms.treename.path variable of the action page. |
enabled |
Optional;Flash |
yes |
Flash format only: Boolean value that specifies whether the control is enabled. A disabled control appears in light gray. |
font |
Optional;Applet, HTML |
|
Font name for text in the tree control. |
fontSize |
Optional;Applet, Flash, HTML |
|
Font size for text in the tree control, in pixels. |
format |
Optional;All |
applet |
|
height |
Optional;Applet, Flash |
320(applet only) |
Tree control height, in pixels. If you omit this attribute in Flash format, Flash automatically sizes the tree. |
highlightHref |
Optional;Applet, Object |
yes |
|
hScroll |
Optional;Applet, object |
yes |
|
hSpace |
Optional;Applet |
|
Horizontal spacing to left and right of tree control, in pixels. |
italic |
Optional;Applet, Flash, HTML |
no |
|
label |
Optional;HTML, |
|
|
lookAndFeel |
Optional;Applet, object |
windows |
|
message |
Optional;Applet, HTML |
|
Message to display if validation fails. |
notSupported |
Optional;Applet |
See Description |
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, for example;"<b> Browser must support Java to view ColdFusion Java Applets</b>"}}Default message:{{<b>Browser must support Java to <br>view ColdFusion Java Applets!</b> |
onBlur |
Optional;Flash |
|
ActionScript to run when the tree loses focus. |
onChange |
Optional;Flash |
|
ActionScript to run when the control changes due to user action. |
onError |
Optional;Applet, HTML |
|
A JavaScript function to run if validation fails. |
onFocus |
Optional;Flash |
|
ActionScript to run when the tree gets focus. The JavaScript DOM form object, value of the name attribute, value that failed validation, and any error text specified by the message attribute are passed to the method. |
onValidate |
Optional;Applet, HTML |
|
JavaScript function to validate user input. The JavaScript DOM form object, input object, and input object value are passed to the specified routine, which must return true if validation succeeds; false, otherwise. |
required |
Optional;Applet, Flash, HTML |
no |
|
style |
Optional;Flash, HTML |
|
Must be a style specification in CSS format. In HTML format, this attribute corresponds to the value of an HTML style attribute. In Flash format, use the same syntax and contents as used in Flex for the corresponding Flash element. |
tooltip |
Optional;Flash |
|
Flash format only: Text to display when the mouse pointer hovers over the control. |
value |
Optional;HTML, |
|
|
visible |
Optional;Flash |
yes |
Flash format only: Boolean value that specifies whether to show the control. Space that would be occupied by an invisible control is blank. |
vScroll |
Optional;Applet, object |
yes |
|
vSpace |
Optional;Applet |
|
Vertical margin above and below tree control, in pixels. |
width |
Optional;Applet, Flash |
200 (applet only) |
Tree control width, in pixels. If you omit this attribute in Flash format, Flash automatically sizes the tree. |
All attributes are passed to the XML generated in XML format, but no ColdFusion skin interprets cftree XML.
Usage
This tag must be in a cfform tag block. The applet format tree requires the client to download a Java applet. Also, if the client does not have an up-to-date Java plug-in installed, the system might also have to download an updated Java plug-in to display an applet format tree. The Flash format tree uses a Flash control, and can be embedded in an HTML format cfform tag. For this tag to work properly in Flash, HTML, or applet format, the browser must also be JavaScript-enabled.
If you specify Flash format for this tag in an HTML format form, and you do not specify height and width attributes, Flash takes up more than the remaining visible area on the screen. If any other output follows the tree, including any form controls, users must scroll to see it. Therefore, if you follow a Flash tree in an HTML form with additional output, specify height and width values.
If the following conditions are true, a user's selection from query data that populates this tag's options continues to display after the user submits the form:
- The cfform preserveData attribute is set to "yes"
- The cfform action attribute posts to the same page as the form itself (this is the default), or the action page has a form that contains controls with the same names as corresponding controls on the user entry formFor more information, see the cfform tag entry.
Form variables
When you select a tree item and submit the form that contains the tree, ColdFusion creates a structure with two variables in the action page Form scope. The structure name is the tree name. The following table lists the fields:
Field |
Value |
---|---|
path |
The path through the tree to the selected node, in the form [root]node_1_node_2_\.... In applet format, the path includes the root node only if the completePath attribute is true. In Flash format, the path always includes the root node. |
node |
The value of the selected tree node. |
object format
If you specify object in the format attribute, ColdFusion returns the tree as a ColdFusion structure, and does not send the tree to the browser. You can, for example, loop over the structure to populate a menu, generate "breadcrumb" links for page navigation, or create a DHTML tree.
If you specify an object format tree in an XML format form, ColdFusion does not generate the tree.
The structure variable name is specified by the cftree name attribute. The top level of the structure has two types of entries:
- Attribute settings
- A children array
Attribute settings
The structure has top-level entries with the values of the following cftree attributes:
align |
completePath |
highlightHref |
lookAndFeel |
appendKey |
delimiter |
hScroll |
name |
bold |
fontWeight |
italic |
vscroll |
border |
|
|
|
Children array
The top-level children entry is an array of items entries. Each item has the following entries:
Field |
Value |
---|---|
children |
This item's child items; an array of item structures. |
display |
Tree item label, as determined by the cftreeitem display attribute. |
expand |
Whether to expand the item to display any children; value of cftreeitem expand attribute. |
href |
The URL to link to when the user selects the item; value of the cftreeitem href attribute. |
img |
The tree image icon Image to display as an icon for the tree item; value of cftreeitem img attribute. You can use the img attribute to display custom icons only in the Applet version; not in the Flash version. |
imgOpen |
Image to display when the tree item is open (expanded); value of cftreeitem imgopen attribute. |
parent |
Value of this item's parent item in the tree. |
path |
The node path from the tree root to the current element. |
queryAsRoot |
Whether the query is the root of the item; value of cftreeitem queryAsRoot attribute. |
target |
The link target, such as _blank; value of the item's cftreeitem target attribute. |
value |
The item's value, as determined by the cftreeitem value attribute. |
Example
The following example creates a tree that shows available courses from the CourseList table of the cfdocexamples database, and puts each department's courses in a folder. This example is displayed in Flash and uses the Departments list to get department names.
SELECT d.dept_name, c.course_id, c.CorName, c.CorLevel, c.corName ||' ( ' ||c.corLevel ||' )' AS corLabel FROM CourseList c, Departments d WHERE d.Dept_ID = c.Dept_ID ORDER BY d.dept_Name, c.corName, c.corLevel </cfquery> <cfform name="studentForm" format="flash" width="400" height="450"> <cftree name="courseTree" width="350" height="400"> <cftreeitem query="getCourses" value="dept_name,Course_id" display="dept_name,CorLabel" queryasroot="NO" expand="yes,no"> </cftree> </cfform>
The following example creates a tree that shows the basic information about all employees in an organization, organized by department. The departments are expanded to show all employees. You click the + signs to display additional information. If you click the employee name, ColdFusion links back to the same page and displays the Path and node values for the selection.
<!--- Group the output by Department. (All fields are required in Group By clause.) ---> <cfquery name = "GetEmployees" dataSource = "cfdocexamples"> SELECT Emp_ID, FirstName, LastName, EMail, Phone, Department FROM Employees GROUP BY Department, Emp_ID, FirstName, LastName, EMail, Phone </cfquery> <html> <body> <h3>cftree Example</h3> <!--- The following runs if the user clicked on a link in the tree. A complete application would use the ID for additional processing. ---> <cfif isdefined("Form.fieldnames")> <b>Selected item information</b><br> <cfoutput> <b>Path: </b>#form.Employees.Path#<br> <b>node: </b>#form.Employees.node#<br> <br> </cfoutput> </cfif> <!--- Display the tree. The cftree tag must be in a cfform. ---> <cfform action="#cgi.script_name#" preservedata="Yes" format="Flash"> <cftree name = "Employees" height = "400" width = "400" font = "Arial Narrow" italic="yes" highlighthref="No" HScroll="no" VScroll="no" completepath="no" lookandfeel="windows" border="No" required="yes"> <!--- cfoutput tag with a group attribute loops over the departments. ---> <cfoutput group="Department" query = "GetEmployees"> <cftreeitem value="#Department#" parent="Employees" expand="yes"> <!--- This cfoutput tag loops over the records for the department. The cfoutput tag does not need any attributes. ---> <cfoutput> <!--- Create an item for each employee in the department. Do not expand children. Each employee name links to this page, and sends the employee ID in the query string.---> <cftreeitem value = "#LastName#, #FirstName#" parent = "#Department#" expand="false" img="cd" href="#cgi.script_name#?user_id=#emp_id#"> <!--- Each Employee entry has Id, and contact info children. ---> <cftreeitem value = "#Emp_ID#" display = "Employee ID: #Emp_ID#" parent = "#LastName#, #FirstName#" img="remote"> <!--- Each node must be unique value, so use Emp_ID om value. ---> <cftreeitem value = "#Emp_ID#_ContactInfo" img="computer" display = "Contact Information" parent = "#LastName#, #FirstName#" expand = "false"> <!--- ContacInfo has two children ---> <cftreeitem value = "#Phone#" parent = "#Emp_ID#_ContactInfo"> <cftreeitem value = "#Email#" parent = "#Emp_ID#_ContactInfo"> </cfoutput> </cfoutput> </cftree> <cfinput type="Submit" name="submitit" value="Submit" width="100"> </cfform>