Macromedia CFML User Manual

CFML Quick Reference
© 2001 Macromedia Incorporated. All rights reserved. This manual, as well as the software described in it, is furnished
under license and may be used or copie d only in accordance with the terms of such license. The content of this manual is furnished for informational use only, is subject to change without notice, and should not be construed as a commitment by Macromedia Incorporated. Macromedia Incorporated assumes no responsibility or liability for any errors or inaccuracies that may appear in this book.
Except as permitted by such license, no part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, recording, or otherwise, without the prior written permission of Macromedia Incorporated.
ColdFusion and HomeSite are federally registered trademarks of Macromedia Incorporated. HomeSite, the ColdFusion logo and the Allaire logo are trademarks of Macromedia Incorporated in the USA and other countries. Microsoft, Windows, Windows NT, Windows 95, Microsoft Access, and FoxPro are registered trademarks of Microsoft Corporation. Solaris is a trademark of Sun Microsystems Inc. UNIX is a trademark of The Open Group. PostScript is a trademark of Adobe Systems Inc. All other products or name brands are the trademarks of their respective holders.
Part number: ZCF50MQKREF
Macromedia® Incorporated
Contents
CFML Tags ............................................................. 1
CFML Functions ..................................................14
Array functio ns .....................................................................14
Authentication functions ..................................................14
Conversion func tions .............................................. ...........14
Date and time functions ...................................................14
Decision functions ............................................................ ...15
Display and formatting functions ..................................15
Dynamic evaluation functions ........................................16
International functions ......................................................16
List Functions ........................................................................16
Mathematical functions ....................................................17
Query functions ....................................................................17
String functions ....................................................................17
Structure functions .............................................................18
System functions .................................................................19
Other functions ....................................................................19
ColdFusion Variables .........................................20
Variable scope ......................................................................20
Client variables .....................................................................20
Server variables ....................................................................20
Application and session variables .................................20
Custom tag variables ..........................................................21
Request variable ..................................................................21
Form variable ........................................................................21
ColdFusion Tag-Specific Variables ...................22
ColdFusion query variables .............................................22
CFCATCH variables ..............................................................22
CFDIRECTORY variables .....................................................23
CFERROR variables ..............................................................23
CFFILE ACTION=Upload variables .................................24
CFFTP error variables ..........................................................24
CFFTP ReturnValue variable ............................................24
CFFTP query object columns ...........................................25
CFHTTP variables .... ........................................ .....................25
CFLDAP variables .................................................................25
CFPOP variable s .................................... ...............................25
CFQUERY and CFSTOREDPROC variables ...................26
CFREGISTRY variables ........................................................26
CFSEARCH variables ........................................ ...................26
CFML Quick Reference iii
CFSERVLET variables ..........................................................26
Standard CGI Variables ......................................27
Request ...................................................................................27
Server ...................................................................................... 27
Client ....................................................................................... 27
ColdFusion Studio Keyboard Shortcuts ...........28
File and document keyboard shortcuts .....................28
Debugger Keyboard Shortcuts ...................................... 31
iv CFML Quick Reference

CFML Tags

cfabort

<cfabort showError = "error_message">

cfapplet

<cfapplet appletSource = "applet_name"
name = "form_variable_name" height = "height_in_pixels" width = "width_in_pixels" vSpace = "space_above_and_below_in_pixels" hSpace = "space_on_each_side_in_pixels" align = "Left" or "Right" or "Bottom" or "Top" or "TextTop" or "Middle" or "AbsMiddle" or "Baseline" or "AbsBottom" notSupported = "message_to_display_for_nonJava_browser" param_1 = "applet_parameter_name" param_2 = "applet_parameter_name" param_n = "applet_parameter_name">

cfapplication

<cfapplication name = "application_name"
clientManagement = "Yes" or "No" clientStorage = "datasource_name" or "Registry" or
"Cookie" setClientCookies = "Yes" or "No" sessionManagement = "Yes" or "No" sessionTimeout = #CreateTimeSpan(days, hours,
minutes, seconds)# applicationTimeout = #CreateTimeSpan(days, hours,
minutes, seconds)# setDomainCookies = "Yes" or "No">

cfassociate

<cfassociate baseTag = "base_tag_name"
dataCollection = "collection_name">

cfauthenticate

<cfauthenticate securityContext = "security_context"
username = "user_ID" password = "password" setCookie = "Yes" or "No" throwOnFailure = "Yes" or "No" authType = "Basic" or "X509">

cfbreak

<cfbreak>

cfcache

<cfcache action = "cache" or "flush" or "clientCache"
or "optimal" username = "username" password = "password" protocol = "protocol_name" timeout = "#DateAdd(datepart, number, date)#" directory = "directory_name_for_map_file" cacheDirectory = "directory_name_for_cached_pages" expireURL = "wildcarded_URL_reference" port = "port_number">

cfcol

<cfcol header = "column_header_text"
width = "number_indicating_width_of_column" align = "Left" or "Right" or "Center" text = "text_indicating_type_of_text">

cfcollection

<cfcollection action = "create" or "repair" or
"delete" or "optimize" or "map" collection = "collection_name" path = "path_of_verity_directory" language = "English" or "German" or "Finnish"
or "French" or "Danish" or "Dutch" or "Italian"
or "Norwegian" or "Portuguese" or "Spanish"
or "Swedish">

cfcontent

<cfcontent type = "file_type"
deleteFile = "Yes" or "No" file = "filename" reset = "Yes" or "No">
CFML Quick Reference 1

cfcookie

<cfcookie name = "cookie_name"
value = "text" expires = "period" secure = "Yes" or "No" path = "url" domain = ".domain">

cfdirectory

<cfdirectory action = "directory action"
directory = "directory name" name = "query name" filter = "list filter" mode = "permission" sort = "sort specification" newDirectory = "new directory name">

cfdump

<cfdump var = variable_name>

cferror

<cferror type = "request" or "validation" or "monitor"
or "exception" template = "template_path" mailTo = "email_address" exception = "exception_type">

cfexecute

<cfexecute name = " ApplicationName "
arguments = "CommandLine Arguments" outputFile = "Output file name" timeout = "Timeout interval in seconds"> ...
</cfexecute>

cfexit

<cfexit method = "method">

cffile

<cffile action = "upload"
fileField = "formfield" destination = "full_path_name" nameConflict = "behavior" accept = "mime_type/file_type" mode = "permission" attributes = "file_attributes">
<cffile action = "move"
source = "full_path_name" destination = "full_path_name" attributes = "file_attributes">
<cffile action = "rename"
source = "full_path_name" destination = "full_path_name" attributes = "file_attributes">
<cffile action = "copy"
source = "full_path_name" destination = "full_path_name" attributes = "file_attributes">
<cffile action = "delete"
file = "full_path_name">
<cffile action = "read"
file = "full_path_name" variable = "var_name">
<cffile action = "readBinary"
file = "full_path_name" variable = "var_name">
<cffile action = "write"
file = "full_path_name" output = "content" mode = "permission" addNewLine = "Yes" or "No" attributes = "file_attributes">
<cffile action = "append"
file = "full_path_name" output = "string" attributes = "file_attributes">

cfflush

<cfflush interval = integer number of bytes>

cfform

<cfform name = "name"
action = "form_action" preserveData = "Yes" or "No"
2 CFML Quick Reference
enableCAB = "Yes" or "No" onSubmit = "javascript" target = "window_name" encType = "type" passThrough = "HTML_attributes" codeBase = "URL" archive = "URL" > ...
</cfform>

cfftp

<cfftp action = "establish_FTP_connection"
username = "name" password = "password" server = "server" timeout = "timeout in seconds" port = "port" connection = "name" proxyServer = "proxyserver" retryCount = "number" stopOnError = "Yes" or "No" passive = "Yes" or "No">
<cfftp action = "file_or_dir_operation"
username = "name" password = "password" name = "query_name" server = "server" ASCIIExtensionList = "extensions" transferMode = "mode" failIfExists = "Yes" or "No" directory = "directory name" localFile = "filename" remoteFile = "filename" item = "directory or file" existing = "file or directory name" new = "file or directory name" proxyServer = "proxyserver" passive = "Yes" or "No">

cfgraph

<cfgraph type = "bar" or "horizontalBar"
query = "query name" valueColumn = "query column" itemColumn = "query column" URL = "URL string" URLColumn = "query column" showValueLabel = "yes", "no", or "rollover" valueLabelFont = "Arial", "Courier", or "Times" valueLabelSize = number of points valueLocation = "onBar" or "overBar" scaleFrom = integer minimum value scaleTo = integer maximum value showItemLabel = "yes" or "no" itemLabelFont = "Arial", "Courier", or "Times" itemLabelSize = number of points itemLabelOrientation = "horizontal" or "vertical" title = "title text" titleFont = "Arial", "Courier", or "Times" fileFormat = "Flash", "gif" or "jpg" barSpacing = integer number of pixels graphHeight = integer number of pixels graphWidth = integer number of pixels backgroundColor = "Web color" borderColor = "Web color" borderWidth = integer number of pixels depth = integer number of pixels colorList = "Web color list" gridLines = integer number of lines>
... </cfgraph> <cfgraph type = "line"
query = "query name"
valueColumn = "query column"
itemColumn = "query column"
scaleFrom = integer minimum value
scaleTo = integer maximum value
showItemLabel = "yes" or "no"
itemLabelFont = "Arial", "Courier", or "Times"
itemLabelSize = number of points
itemLabelOrientation = "horizontal" or "vertical"
title = "title text"
titleFont = "Arial", "Courier", or "Times"
CFML Quick Reference 3
fileFormat = "Flash", "gif" or "jpg" lineColor = "Web color" lineWidth = integer number of pixels fill = "yes" or "no" graphHeight = integer number of pixels graphWidth = integer number of pixels backgroundColor = "Web color" borderColor = "Web color" borderWidth = integer number of pixels depth = integer number of pixels
gridLines = integer number of lines> ... </cfgraph> <cfgraph type = "pie"
query = "query name"
valueColumn = "query column"
itemColumn = "query column" <!--- data drill down attributes --->
URL = "URL string"
URLColumn = "query column" <!--- pie chart value display attributes --->
showValueLabel = "yes", "no", or "rollover"
valueLabelFont = "Arial", "Courier", or "Times"
valueLabelSize = number of points
valueLocation = "inside" or "outside"
title = "title text"
titleFont = "Arial", "Courier", or "Times"
showLegend = "above", "below", "left", "right",
or "none" legendFont = "Arial", "Courier", or "Times" fileFormat = "Flash", "gif" or "jpg" graphHeight = integer number of pixels graphWidth = integer number of pixels backgroundColor = "Web color" borderColor = "Web color" borderWidth = integer number of pixels depth = integer number of pixels colorList = "Web color list"> ...
</cfgraph>

cfgraphdata

<cfgraphdata item = "data item"
value = data value item = "label string" color = "Web color" URL = "URL string">

cfgrid

<cfgrid name = "name"
height = "integer" width = "integer" autoWidth = "Yes" or "No" vSpace = "integer" hSpace = "integer" align = "value" query = "query_name" insert = "Yes" or "No" delete = "Yes" or "No" sort = "Yes" or "No" font = "column_font" fontSize = "size" italic = "Yes" or "No" bold = "Yes" or "No" textColor = "Web color" href = "URL" hrefKey = "column_name" target = "URL_target" appendKey = "Yes" or "No" highlightHref = "Yes" or "No" onValidate = "javascript_function" onError = "text" gridDataAlign = "position" gridLines = "Yes" or "No" rowHeight = "pixels" rowHeaders = "Yes" or "No" rowHeaderAlign = "position" rowHeaderFont = "font_name" rowHeaderFontSize = "size" rowHeaderItalic = "Yes" or "No" rowHeaderBold = "Yes" or "No"
4 CFML Quick Reference
rowHeaderTextColor = "Web color" rowHeaderWidth = "col_width" colHeaders = "Yes" or "No" colHeaderAlign = "position" colHeaderFont = "font_name" colHeaderFontSize = "size" colHeaderItalic = "Yes" or "No" colHeaderBold = "Yes" or "No" colHeaderTextColor = "Web color" bgColor = "Web color" selectColor = "Web color" selectMode = "mode" maxRows = "number" notSupported = "text" pictureBar = "Yes" or "No" insertButton = "text" deleteButton = "text" sortAscendingButton = "text" sortDescendingButton = "text">
</cfgrid>

cfgridcolumn

<cfgridcolumn name = "column_name"
header = "header" width = "column_width" font = "column_font" fontSize = "size" italic = "Yes" or "No" bold = "Yes" or "No" textColor = "Web color" or "expression" bgColor = "Web color" or "expression" href = "URL" hrefKey = "column_name" target = "URL_target" select = "Yes" or "No" display = "Yes" or "No" type = "type" headerFont = "font_name" headerFontSize = "size" headerItalic = "Yes" or "No" headerBold = "Yes" or "No" colHeaderTextColor = "Web color" dataAlign = "position" headerAlign = "position" numberFormat = "format" values = "Comma separated strings and/or numeric range" valuesDisplay = "Comma separated strings
and/or numeric range"
valuesDelimiter = "delimiter character">

cfgridrow

<cfgridrow data = "col1, col2, ...">

cfgridupdate

<cfgridupdate grid = "gridname"
dataSource = "data source name" dbType = "type" dbServer = "dbms" dbName = "database name" tableName = "table name" connectString = "connection string" username = "data source username" password = "data source password" tableOwner = "table owner" tableQualifier = "qualifier" provider = "COMProvider" providerDSN = "datasource" keyOnly = "Yes" or "No">

cfheader

<cfheader
name = "header_name"
value = "header_value"> or <cfheader
statusCode = "status_code"
statusText = "status_text">

cfhtmlhead

<cfhtmlhead text = "text">
CFML Quick Reference 5

cfhttp

<cfhttp url = "hostname"
port = "port_number" method = "get_or_post" username = "username" password = "password" name = "queryname" columns = "query_columns" path = "path" file = "filename" delimiter = "character" textQualifier = "character" resolveURL = "yes" or "no" proxyServer = "hostname" proxyPort = "port_number" userAgent = "user_agent" throwOnError = "yes" or "no" redirect = "yes" or "no" timeout = "timeout_period">
</cfhttp>

cfhttpparam

<cfhttpparam name = "name"
type = "type" value = "transaction type" file = "filename">
cfif cfelseif cfelse
<cfif expression>
HTML and CFML tags
<cfelseif>
HTML and CFML tags
<cfelse expression>
HTML and CFML tags
</cfif>

cfimpersonate

<cfimpersonate
securityContext = "SecurityContext" username = "Name" password = "Password" type = "CF" or "OS"> ... HTML or CFML code to execute ...
</cfimpersonate>

cfinclude

<cfinclude template = "template_name">

cfindex

<cfindex collection = "collection_name"
action = "action" type = "type" title = "title" key = "ID" body = "body" custom1 = "custom_value" custom2 = "custom_value" URLpath = "URL" extensions = "file_extensions" query = "query_name" recurse = "Yes" or "No" external = "Yes" or "No" language = "language">

cfinput

<cfinput type = "input_type"
name = "name" value = "initial_value" required = "Yes" or "No" range = "min_value, max_value" validate = "data_type" onValidate = "javascript_function" pattern = "regexp" message = "validation_msg" onError = "text" size = "integer" maxLength = "integer" checked passThrough = "HTML_attributes">
6 CFML Quick Reference

cfinsert

<cfinsert dataSource = "ds_name"
dbType = "type"
dbServer = "dbms"
dbName = "database name"
tableName = "tbl_name"
connectString = "connection string"
tableOwner = "owner"
tableQualifier = "tbl_qualifier"
username = "username"
password = "password"
provider = "COMProvider"
providerDSN = "datasource"
formFields = "formfield1, formfield2, ...">

cfldap

<cfldap server = "server_name"
port = "port_number"
username = "name"
password = "password"
action = "action"
name = "name"
timeout = "seconds"
maxRows = "number"
start = "distinguished_name"
scope = "scope"
attributes = "attribute, attribute"
filter = "filter"
filterFile = "<file_name>,<stanza_name>"
sort = "attribute[, attribute]..."
sortControl = "nocase" and/or "desc" or "asc"
dn = "distinguished_name"
startRow = "row_number"
modifyType = "REPLACE" or "ADD" or "delete"
rebind = "Yes" or "No"
referral = "number_of_allowed_hops"
secure = "multi_field_security_string"
separator = "separator_character"
delimiter = "delimiter_character">

cflocation

<cflocation url = "url" addToken = "Yes" or "No">

cflock

<cflock timeout = "timeout in seconds "
scope = "Application" or "Server" or "Session"
name = "lockname"
throwOnTimeout = "Yes" or "No"
type = "readOnly/Exclusive ">
<!--- CFML to be synchronized ---> </cflock>

cflog

<cflog text = "text"
log = "log type"
file = "filename"
type = "message type"
thread = "thread ID yes or no"
date = "date yes or no"
time = "time yes or no"
application = "application name yes or no">

cfloop

<cfloop index = "parameter_name"
from = "beginning_value"
to = "ending_value"
step = "increment">
...
HTML or CFML code to execute ... </cfloop> <cfloop condition = "expression"> <cfloop query = "query_name"
startRow = "row_num"
endRow = "row_num"> <cfloop index = "index_name"
list = "list_items"
delimiterS = "item_delimiter"> </cfloop>
CFML Quick Reference 7
Loading...
+ 25 hidden pages