Quick Reference to CFML
© 1999 Allaire Corporation. All rights reserved.
This manual, as well as the software described in it, is furnished
under license and may be used or copied 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 Allaire Corporation.
Allaire Corporation 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 Allaire
Corporation.
ColdFusion and HomeSite are federally registered trademarks of
Allaire Corporation. HomeSite, the ColdFusion logo, and the Allaire
logo are trademarks of Allaire Corporation in the USA and other
countries. Microsoft, Windows, Windows NT, Windows 95, Microsoft
Access, and FoxPro are registered trademarks of Microsoft
Corporation. All other products or name brands are the trademarks
of their respective holders. Solaris is a trademark of Sun
Mi cr os yst em s I nc. UN IX is a tr ad em ark of Th e O pen Gr ou p. P os tSc ri pt
is a trademark of Adobe Systems Inc.
Part number: AA-45QKR-RK
Allaire Corporation
Contents
CFML Tags ............................................................. 1
CFML Functions ..................................................12
Array functions .....................................................................12
Date and time functions ...................................................12
Decision functions ...............................................................13
Display and formatting functions ..................................13
Dynamic evaluation functions ........................................13
Format conversion functions ..........................................13
List functions .........................................................................14
International functions ......................................................14
Mathematical functions ....................................................14
Query functions ....................................................................15
String functions ....................................................................15
Structure functions .............................................................16
System functions .................................................................16
Other functions ....................................................................17
ColdFusion Variables ......................................... 18
Variable scope ......................................................................18
Client variables .....................................................................18
Server variables ....................................................................18
Application and session variables .................................18
Custom tag variables ..........................................................19
Request variable ..................................................................19
Form variable ........................................................................19
ColdFusion Tag-Specific Variables ...................20
ColdFusion query variables .............................................20
CFCATCH variables ..............................................................20
CFDIRECTORY variables .....................................................21
CFERROR variables ..............................................................21
CFFILE ACTION=Upload variables .................................22
CFFTP error variables ..........................................................22
CFFTP ReturnValue variable ............................................22
CFFTP query object columns ...........................................23
CFHTTP variables .................................................................23
CFLDAP variables .................................................................23
CFPOP variables ...................................................................23
CFQUERY and CFSTOREDPROC variables ...................24
CFREGISTRY variables ........................................................24
CFSEARCH variables ...........................................................24
CFSERVLET variables ...........................................................24
Quick Reference to CFML iii
Standard CGI Variables ......................................25
Request ................................................................................... 25
Server ......................................................................................25
Client ....................................................................................... 25
ColdFusion Studio Keyboard Shortcuts ...........26
File and Document Keyboard Shortcuts .................... 26
Debugger Keyboard Shortcuts ...................................... 29
iv Quick Reference to CFML
CFML Tags
CFABORT
<CFABORT SHOWERROR="text">
CFAPPLET
<CFAPPLET APPLETSOURCE="applet_name"
NAME="form_variable_name"
HEIGHT="pixels"
WIDTH="pixels"
VSPACE="pixels"
HSPACE="pixels"
ALIGN="alignment"
NOTSUPPORTED="text"
param_1="value"
param_2="value"
param_n="value">
CFAPPLICATION
<CFAPPLICATION NAME="Name"
CLIENTMANAGEMENT="Yes" or "No"
CLIENTSTORAGE="Storage Type"
SETCLIENTCOOKIES="Yes" or "No"
SESSIONMANAGEMENT="Yes" or "No"
SESSIONTIMEOUT=#CreateTimeSpan(days, hours,
minutes, seconds)#
APPLICATIONTIMEOUT=#CreateTimeSpan(days, hours,
minutes, seconds)#
SETDOMAINCOOKIE="Yes" or "No">
CFASSOCIATE
<CFASSOCIATE BASETAG="tagname"
DATACOLLECTION="collectionname">
CFAUTHENTICATE
<CFAUTHENTICATE SECURITYCONTEXT="context"
USERNAME="user ID"
PASSWORD="password"
SETCOOKIE="Yes" or "No"
THROWONFAILURE="Yes" or "No">
CFBREAK
<CFBREAK>
CFCACHE
<CFCACHE
ACTION="action"
PROTOCOL="protocol name"
TIMEOUT="timeout date-time"
DIRECTORY="directory name for map file"
CACHEDIRECTORY="directory name for cached pages"
EXPIREURL="wildcarded URL reference"
PORT= "port-number ">
CFCOL
<CFCOL HEADER="text"
WIDTH="number"
ALIGN="position"
TEXT="text">
CFCOLLECTION
<CFCOLLECTION ACTION="action"
COLLECTION="collection"
PATH="implementation directory"
LANGUAGE="language">
CFCONTENT
<CFCONTENT TYPE="file_type"
DELETEFILE="Yes" or "No"
FILE="filename"
RESET="Yes" or "No">
CFCOOKIE
<CFCOOKIE NAME="cookie_name"
VALUE="text"
EXPIRES="period"
SECURE="Yes" or "No"
PATH="urls"
DOMAIN=".domain">
Quick Reference to CFML 1
CFDIRECTORY
<CFDIRECTORY ACTION="directory action"
DIRECTORY="directory name"
NAME="query name"
FILTER="list filter"
MODE="permission"
SORT="sort specification"
NEWDIRECTORY="new directory 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">
CFEXIT
<CFEXIT METHOD="method">
CFFILE
<CFFILE ACTION="Upload"
FILEFIELD="formfield"
DESTINATION="full_path_name"
NAMECONFLICT="behavior"
ACCEPT="mime_type" or "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">
CFFORM
<CFFORM NAME="name"
ACTION="form_action"
ENABLECAB="Yes" or "No"
ONSUBMIT="javascript"
TARGET="window_name"
ENCTYPE="type"
PASSTHROUGH="HTML_attributes">
...
</CFFORM>
CFFTP
<CFFTP ACTION="action"
USERNAME="name"
PASSWORD="password"
SERVER="server"
TIMEOUT="timeout in seconds"
2Q u i c k R e f e r e n c e t o C F M L
PORT="port"
CONNECTION="name"
PROXYSERVER="proxyserver"
PROXYBYPASS="proxybypass"
RETRYCOUNT="number"
STOPONERROR="Yes" or "No"
PASSIVE="Yes" or "No">
or
<CFFTP
ACTION="action"
USERNAME="name"
PASSWORD="password"
NAME="query_name"
SERVER="server"
ASCIIEXTENSIONLIST="extensions"
TRANSFERMODE="mode"
FAILIFEXISTS="Yes" or "No"
DIRECTORY="directory name"
LOCALFILE="filename"
REMOTEFILE="filename"
ATTRIBUTES="file attributes"
ITEM="directory or file"
EXISTING="file or directory name"
NEW="file or directory name"
PROXYSERVER="proxyserver"
PROXYBYPASS="proxybypass"
PASSIVE="Yes" or "No">
CFGRID
<CFGRID NAME="name"
HEIGHT="integer"
WIDTH="integer"
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"
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"
ROWHEADERWIDTH="col_width"
COLHEADERS="Yes" or "No"
COLHEADERALIGN="position"
COLHEADERFONT="font_name"
COLHEADERFONTSIZE="size"
COLHEADERITALIC="Yes" or "No"
COLHEADERBOLD="Yes" or "No"
BGCOLOR="color"
SELECTCOLOR="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"
Quick Reference to CFML 3
FONT="column_font"
FONTSIZE="size"
ITALIC="Yes" or "No"
BOLD="Yes" or "No"
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"
DATAALIGN="position"
HEADERALIGN="position"
NUMBERFORMAT="format">
CFGRIDROW
<CFGRIDROW DATA="col1, col2, ...">
CFGRIDUPDATE
<CFGRIDUPDATE GRID="gridname"
DATASOURCE="data source name"
DBTYPE="type"
DBSERVER="dbms"
DBNAME="database name"
TABLENAME="table name"
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">
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>
4Q u i c k R e f e r e n c e t o C F M L
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"
MESSAGE="validation_msg"
ONERROR="text"
SIZE="integer"
MAXLENGTH="integer"
CHECKED="Yes" or "No"
PASSTHROUGH="HTML_attributes">
CFINSERT
<CFINSERT DATASOURCE="ds_name"
DBTYPE="type"
DBSERVER="dbms"
DBNAME="database name"
TABLENAME="tbl_name"
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">
Quick Reference to CFML 5
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" or "Exclusive ">
<!--- CFML to be synchronized --->
</CFLOCK>
CFLOOP
<CFLOOP INDEX="parameter_name"
FROM="beginning_value"
TO="ending_value"
STEP="increment">
...
HTML or CFML code to execute
...
</CFLOOP>
or
<CFLOOP CONDITION="expression">
or
<CFLOOP QUERY="query_name"
STARTROW="row_num"
ENDROW="row_num">
or
<CFLOOP INDEX="index_name"
LIST="list_items"
DELIMITERS="item_delimiter">
</CFLOOP>
CFMAIL
<CFMAIL TO="recipient"
FROM="sender"
CC="copy_to"
BCC="blind_copy_to"
SUBJECT="msg_subject"
TYPE="msg_type"
MAXROWS="max_msgs"
MIMEATTACH="path"
QUERY="query_name"
GROUP="query_column"
GROUPCASESENSITIVE="Yes" or "No"
STARTROW="query_row"
SERVER="servername"
PORT="port_ID"
MAILERID="headerid"
TIMEOUT="seconds">
CFMAILPARAM
<CFMAIL
TO="recipient"
SUBJECT="msg_subject"
FROM="sender"
...more attibutes...>
<CFMAILPARAM
FILE="file-name"
>
or
<CFMAILPARAM
NAME="header-name"
VALUE="header-value"
>
...
</CFMAIL>
CFMODULE
<CFMODULE TEMPLATE="template"
NAME="tag_name"
ATTRIBUTECOLLECTION="collection_structure"
ATTRIBUTE_NAME1="value
ATTRIBUTE_NAME2="
...>
value
"
"
6Q u i c k R e f e r e n c e t o C F M L
CFOBJECT
<CFOBJECT TYPE="COM"
ACTION="action"
CLASS="program_ID"
NAME="text"
CONTEXT="context"
SERVER="server_name">
or
<CFOBJECT TYPE="CORBA"
CONTEXT="context"
CLASS="file or naming service"
NAME="text"
LOCALE="type-value arguments">
or
<CFOBJECT
TYPE="Java"
ACTION="Create"
CLASS="Java class"
NAME="object name">
CFOUTPUT
<CFOUTPUT MAXROWS="max_rows_output"
QUERY="query_name"
GROUP="query_column"
GROUPCASESENSITIVE="Yes" or "No"
STARTROW="start_row">
</CFOUTPUT>
CFPARAM
<CFPARAM NAME="param_name"
TYPE="data_type">
DEFAULT="value">
CFPOP
<CFPOP SERVER="servername"
PORT="port_number"
USERNAME="username"
PASSWORD="password"
ACTION="action"
NAME="queryname"
MESSAGENUMBER="number"
ATTACHMENTPATH="path"
TIMEOUT="seconds"
MAXROWS="number"
STARTROW="number"
GENERATEUNIQUEFILENAMES="boolean">
CFPROCESSINGDIRECTIVE
<CFPROCESSINGDIRECTIVE
SUPPRESSWHITESPACE="Yes" or "No">
… any CFML tags here …
</CFPROCESSINGDIRECTIVE>
CFPROCPARAM
<CFPROCPARAM TYPE="IN" or "OUT" or "INOUT"
VARIABLE="variable name"
DBVARNAME="DB variable name"
VALUE="parameter value"
CFSQLTYPE="parameter datatype"
MAXLENGTH="length"
SCALE="decimal places"
NULL="Yes" or "No">
CFPROCRESULT
<CFPROCRESULT NAME="query_name"
RESULTSET="1-n"
MAXROWS="maxrows">
Quick Reference to CFML 7