
839
DEVELOPING
COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
Las
t
upda
te
d 8/5/2010
value="#listLast(arguments.value)#">
</cfquery>
<cfloop query="q">
<cfset s = structNew()>
<cfset s.value = arguments.value & "," & artid>
<cfset s.display = artname & " (" & dollarFormat(price) & ")">
<cfset s.href = "javaScript:loadImage('#largeimage#');">
<cfset s.children=arrayNew(1)>
<!--- leafnode=true prevents node expansion and further calls to the
bind expression. --->
<cfset s.leafnode=true>
<cfset arrayAppend(result, s)>
</cfloop>
</cfif>
<cfreturn result>
</cffunction>
</cfcomponent>
Binding other controls to a tree
ColdFusion tags that use bind expressions can bind to the selected node of a tree by using the following formats:
•
{[
form
:]
tree
.node} retrieves the value of the selected tree node.
•
{[
form
:]
tree
.path} retrieves the path of the selected tree node. If the
completePath
attribute value is
true
, the
bound path includes the root node.
The bind expression is evaluated each time a
select
event occurs on an item in the tree. If you specify any other event
in the bind parameter, it is ignored.
Tree JavaScript functions
You can use the following JavaScript functions to manage an HTML tree:
For more information, see the ColdFusion.Tree.getTreeObject and ColdFusion.Tree.refresh functions in the
CFML
Reference
.
Using the rich text editor
The ColdFusion rich text editor lets users enter and format rich HTML text by using an icon-driven interface based
on the open source FCKeditor Ajax widget. The editor includes numerous formatting controls, and icons for such
standard operations as searching, printing, and previewing text. Text editor controls are not covered. For detailed
information on the editor icons and controls, see
http://wiki.fckeditor.net/UsersGuide
.
Note:
Do not bind to a rich text area on load of a page, for example, from another control, such as a text box.
The following example shows a simple rich text editor. When a user enters text and clicks the Enter button, the
application refreshes and displays the formatted text above the editor region.
Function
Description
ColdFusion.Tree.getTreeObject
Gets the underlying Yahoo User Interface Library TreeView JavaScript object.
ColdFusion.Tree.refresh
Manually refreshes a tree.