Detailed instructions for use are in the User's Guide.
[. . . ] 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. [. . . ] </CFQUERY>
CFREGISTRY
<CFREGISTRY ACTION="GetAll" BRANCH="branch" TYPE="data type" NAME="query name" SORT="criteria"> or <CFREGISTRY ACTION="Get" BRANCH="branch" ENTRY="key or value" TYPE="data type" VARIABLE="variable"> or <CFREGISTRY ACTION="Set" BRANCH="branch" ENTRY="key or value" TYPE="value type" VALUE="data"> or <CFREGISTRY ACTION="Delete" BRANCH="branch" ENTRY="keyorvalue">
CFREPORT
<CFREPORT REPORT="report_path" ORDERBY="result_order" USERNAME="username" PASSWORD="password" FORMULA="formula"> </CFREPORT>
CFRETHROW
<CFRETHROW>
CFSCRIPT
<CFSCRIPT> CFScript code goes here </CFSCRIPT>
8
Quick Reference to CFML
CFSEARCH
<CFSEARCH NAME="search_name" COLLECTION="collection_name" TYPE="criteria" CRITERIA="search_expression" MAXROWS="number" STARTROW="row_number" EXTERNAL="Yes" or "No" LANGUAGE="language">
CFSELECT
<CFSELECT NAME="name" REQUIRED="Yes" or "No" MESSAGE="text" ONERROR="text" SIZE="integer" MULTIPLE="Yes" or "No" QUERY="queryname" SELECTED="column_value" VALUE="text" DISPLAY="text" PASSTHROUGH="HTML_attributes"> </CFSELECT>
CFSERVLET
<CFSERVLET CODE="class name of servlet" JRUNPROXY="proxy server" TIMEOUT="timeout in seconds" WRITEOUTPUT="Yes" or "No" DEBUG="Yes" or "No"> <CFSERVLETPARAM NAME="parameter name" VALUE="value" > . . . </CFSERVLET>
CFSERVLETPARAM
<CFSERVLET . . . > <CFSERVLETPARAM NAME="servlet parameter name" VALUE="servlet parameter value" > . . . <CFSERVLETPARAM NAME="servlet attribute name" VARIABLE="ColdFusion variable name" TYPE="INT" or "DOUBLE" or "BOOL" or "DATE" or "STRING" > . . . </CFSERVLET>
CFSET
<CFSET variable_name=expression>
CFSETTING
<CFSETTING ENABLECFOUTPUTONLY="Yes" or "No" SHOWDEBUGOUTPUT="Yes" or "No" CATCHEXCEPTIONBYPATTERN="Yes" or "No" >
CFSILENT
<CFSILENT>
CFSLIDER
<CFSLIDER NAME="name" LABEL="text" REFRESHLABEL="Yes" or "No" IMG="filename" IMGSTYLE="style" RANGE="min_value, max_value" SCALE="uinteger" VALUE="integer" ONVALIDATE="script_name" MESSAGE="text" ONERROR="text" HEIGHT="integer" WIDTH="integer" VSPACE="integer" HSPACE="integer" ALIGN="alignment"
Quick Reference to CFML
9
GROOVECOLOR="color" BGCOLOR="color" TEXTCOLOR="color" FONT="font_name" FONTSIZE="integer" ITALIC="Yes" or "No" BOLD="Yes" or "No" NOTSUPPORTED="text">
CFSTOREDPROC
<CFSTOREDPROC PROCEDURE="procedure name" DATASOURCE="ds_name" USERNAME="username" PASSWORD="password" DBSERVER="dbms" DBNAME="database name" BLOCKFACTOR="blocksize" PROVIDER="COMProvider" PROVIDERDSN="datasource" DEBUG="Yes" or "No" RETURNCODE="Yes" or "No">
CFSWITCH CFCASE CFDEFAULTCASE
<CFSWITCH EXPRESSION="expression"> <CFCASE VALUE="value" DELIMITERS="delimiters"> HTML and CFML tags </CFCASE> additional <CFCASE></CFCASE> tags <CFDEFAULTCASE> HTML and CFML tags </CFDEFAULTCASE> </CFSWITCH>
CFTABLE
<CFTABLE QUERY="query_name" MAXROWS="maxrows_table" COLSPACING="number_of_spaces" HEADERLINES="number_of_lines" HTMLTABLE BORDER COLHEADERS STARTROW="row_number"> </CFTABLE>
CFTEXTINPUT
<CFTEXTINPUT NAME="name" VALUE="text" REQUIRED="Yes" or "No" RANGE="min_value, max_value" VALIDATE="data_type" ONVALIDATE="script_name" MESSAGE="text" ONERROR="text" SIZE="integer" FONT="font_name" FONTSIZE="integer" ITALIC="Yes" or "No" BOLD="Yes" or "No" HEIGHT="integer" WIDTH="integer" VSPACE="integer" HSPACE="integer" ALIGN="alignment" BGCOLOR="color" TEXTCOLOR="color" MAXLENGTH="integer" NOTSUPPORTED="text">
CFTHROW
<CFTHROW TYPE= "exception_type " MESSAGE="message" DETAIL= "detail_description " ERRORCODE= "error_code " EXTENDEDINFO= "additional_information ">
CFTRANSACTION
<CFTRANSACTION ACTION="BEGIN" or "COMMIT" or "ROLLBACK" ISOLATION="Read_Uncommitted" or "Read_Committed" or "Repeatable_Read"> </CFTRANSACTION>
10
Quick Reference to CFML
CFTREE
<CFTREE NAME="name" REQUIRED="Yes" or "No" DELIMITER="delimiter" COMPLETEPATH="Yes" or "No" APPENDKEY="Yes" or "No" HIGHLIGHTHREF="Yes" or "No" ONVALIDATE="script_name" MESSAGE="text" ONERROR="text" FONT="font" FONTSIZE="size" ITALIC="Yes" or "No" BOLD="Yes" or "No" HEIGHT="integer" WIDTH="integer" VSPACE="integer" HSPACE="integer" ALIGN="alignment" BORDER="Yes" or "No" HSCROLL="Yes" or "No" VSCROLL="Yes" or "No" NOTSUPPORTED="text"> </CFTREE>
CFTREEITEM
<CFTREEITEM VALUE="text" DISPLAY="text" PARENT="parent_name" IMG="filename" IMGOPEN="filename" HREF="URL" TARGET="URL_target" QUERY="queryname" QUERYASROOT="Yes" or "No" EXPAND="Yes" or "No">
CFTRY CFCATCH
<CFTRY> . . . Additional CFCATCH blocks go here </CFTRY>
CFUPDATE
<CFUPDATE DATASOURCE="ds_name" DBTYPE="type" DBSERVER="dbms" DBNAME="database name" TABLENAME="table_name" TABLEOWNER="name" TABLEQUALIFIER="qualifier" USERNAME="username" PASSWORD="password" PROVIDER="COMProvider" PROVIDERDSN="datasource" FORMFIELDS="field_names">
CFWDDX
<CFWDDX ACTION="action" INPUT="inputdata" OUTPUT="resultvariablename" TOPLEVELVARIABLE="toplevelvariablenameforjavascript" USETIMEZONEINFO="Yes" or "No">
Quick Reference to CFML
11
CFML Functions
Array functions
ArrayAppend(array, value) ArrayAvg(array) ArrayClear(array) ArrayDeleteAt(array, position) ArrayInsertAt(array, position, value) ArrayIsEmpty(array) ArrayLen(array) ArrayMax(array) ArrayMin(array) ArrayNew(dimension) ArrayPrepend(array, value) ArrayResize(array, minimum_size) ArraySet(array, start_pos, end_pos, value) ArraySort(array, sort_type [, sort_order ]) ArraySum(array) ArraySwap(array, position1, position2) ArrayToList(array [, delimiter ]) IsArray(value [, number ]) ListToArray(list [, delimiter ])
Date and time functions
CreateDate(year, month, day) CreateDateTime(year, month, day, hour, minute, second) CreateODBCDate(date) CreateODBCDateTime(date) CreateODBCTime(date) CreateTime(hour, minute, second) CreateTimeSpan(days, hours, minutes, seconds) DateAdd(datepart, number, date) DateCompare(date1, date2 [, datePart]) DateConvert(conversion-type, date) DateDiff(datepart, date1, date2) DateFormat(date [, mask ]) DatePart(datepart, date) Day(date) DayOfWeek(date) DayOfWeekAsString(day_of_week) DayOfYear(date) DaysInMonth(date) Hour(date) IsDate(string) IsLeapYear(year) IsNumericDate(number) LSParseDateTime(date-time-string) Minute(date) Month(date) MonthAsString(month_number) Now() ParseDateTime(date-time-string [, pop-conversion ] ) Quarter(date) Second(date) Week(date) Year(date)
12
Quick Reference to CFML
Decision functions
IsArray(value [, number ]) IsAuthenticated([security-context-name ]) IsAuthorized(resourcetype, resourcename [, action ]) IsBinary(value) IsBoolean(value) IsDate(string) IsDebugMode() IsDefined("variable_name") IsLeapYear(year) IsNumeric(string) IsNumericDate(number) IsQuery(value) IsSimpleValue(value) IsStruct(variable ) LSIsCurrency(string) LSIsDate(string) LSIsNumeric(string)
Display and formatting functions
DateFormat(date [, mask ]) DecimalFormat(number) DollarFormat(number) FormatBaseN(number, radix) HTMLCodeFormat(string [, version ]) HTMLEditFormat(string [, version ]) LSCurrencyFormat(number [, type ]) LSDateFormat(date [, mask ]) LSEuroCurrencyFormat(currency-number [, type ]) LSNumberFormat(number [, mask ]) LSTimeFormat(time [, mask ]) NumberFormat(number [, mask ]) ParagraphFormat(string) PreserveSingleQuotes(variable) TimeFormat(time [, mask ]) URLEncodedFormat(string) YesNoFormat(value)
Dynamic evaluation functions
DE(string) Evaluate(string_expression1 [, string_expression2 [, . . . ] ] ) IIf(condition, string_expression1, string_expression2) SetVariable(name, value)
Format conversion functions
JSStringFormat(string) ToBase64(string or binary_object) ToBinary(string_in_Base64 or binary_value) URLDecode(URL_encoded_string) URLEncodedFormat(string) ToString(any_value) XMLFormat(string)
Quick Reference to CFML
13
List functions
ArrayToList(array [, delimiter ]) ListAppend(list, value [, delimiters ]) ListChangeDelims(list, new_delimiter [, delimiters ]) ListContains(list, substring [, delimiters ]) ListContainsNoCase(list, substring [, delimiters ]) ListDeleteAt(list, position [, delimiters ]) ListFind(list, value [, delimiters ]) ListFindNoCase(list, value [, delimiters ]) ListFirst(list [, delimiters ]) ListGetAt(list, position [, delimiters ]) ListInsertAt(list, position, value [, delimiters ]) ListLast(list [, delimiters ]) ListLen(list [, delimiters ]) ListPrepend(list, value [, delimiters ]) ListQualify(list, qualifier [, delimiters ] [, elements ]) ListRest(list [, delimiters ]) ListSetAt(list, position, value [, delimiters ]) ListSort(list, sort_type [, sort_order] [, delimiter ]) ListToArray(list [, delimiter ]) ListValueCount(list, value [, delimiters ]) ListValueCountNoCase(list, value [, delimiters ])
International functions
DateConvert(conversion-type, date) GetLocale() GetTimeZoneInfo() LSCurrencyFormat(number [, type ]) LSDateFormat(date [, mask ]) LSEuroCurrencyFormat(currency-number [, type ]) LSIsCurrency(string) LSNumberFormat(number [, mask ]) LSParseCurrency(string) LSParseDateTime(string) LSParseEuroCurrency(currency-string) LSParseNumber(string) LSTimeFormat(time [, mask ]) SetLocale(new_locale)
Mathematical functions
Abs(number) ACos(number) ASin(number) Atn(number) BitAnd(number1, number2) BitMaskClear(number, start, length) BitMaskRead(number, start, length) BitMaskSet(number, mask, start, length) BitNot(number) BitOr(number1, number2) BitSHLN(number, count) BitSHRN(number, count) BitXor(number1, number2) Ceiling(number) Cos(number)
14
Quick Reference to CFML
DecrementValue(number) Exp(number) Fix(number) IncrementValue(number) InputBaseN(string, radix) Int(number) Log(number) Log10(number) Max(number1, number2) Min(number1, number2) Pi() Rand() Randomize(number) RandRange(number1, number2) Round(number) Sgn(number) Sin(number) Sqr(number) Tan(number)
Query functions
IsQuery(value) QueryAddColumn(query, column-name, array-name) QueryAddRow(query [, number ]) QueryNew(columnlist) QuerySetCell(query, column_name, value [, row_number ]) QuotedValueList(query. column [, delimiter ]) ValueList(query. column [, delimiter ])
String functions
Asc(string) Chr(number) Cjustify(string, length) Compare(string1, string2) CompareNoCase(string1, string2) DayOfWeekAsString(day_of_week) FormatBaseN(number, radix) Find(substring, string [, start ]) FindNoCase(substring, string [, start ]) FindOneOf(set, string [, start ]) GetToken(string, index [, delimiters ]) Insert(substring, string, position) JSStringFormat(string) LCase(string) Left(string, count) Len(string or binary_object) ListValueCount(list, value [, delimiters ]) ListValueCountNoCase(list, value [, delimiters ]) LJustify(string, length) LSParseCurrency(string) LSParseDateTime(date-time-string) LSParseEuroCurrency(currency-string) LSParseNumber(string) LTrim(string) Mid(string, start, count) MonthAsString(month_number)
Quick Reference to CFML
15
ParseDateTime(string1 [, string2 ] ) REFind(reg_expression, string [, start ] [, returnsubexpressions ] ) REFindNoCase(reg_expression, string [, start ] [, returnsubexpressions ] ) RemoveChars(string, start, count) RepeatString(string, count) Replace(string, substring1, substring2 [, scope ]) ReplaceList(string, list1, list2) ReplaceNoCase(string, substring1, substring2 [, scope ]) REReplace(string, reg_expression, substring [, scope ]) REReplaceNoCase(string, reg_expression, substring [, scope ]) Reverse(string) Right(string, count) RJustify(string, length) RTrim(string) SpanExcluding(string, set) SpanIncluding(string, set) StripCR(string) ToString(any_value) Trim(string) UCase(string) Val(string) XMLFormat(string)
Structure functions
IsStruct(variable ) StructClear(structure) StructCopy(structure) StructCount(structure) StructDelete(structure, key [, indicatenotexisting ]) StructFind(structure, key) StructInsert(structure, key, value [, allowoverwrite ]) StructIsEmpty(structure) StructKeyArray(structure) StructKeyExists(structure, key) StructKeyList(structure [, delimiter]) StructNew() StructUpdate(structure, key, value)
System functions
DirectoryExists(absolute_path) ExpandPath(relative_path) FileExists(absolute_path) GetBaseTemplatePath() GetCurrentTemplatePath() GetDirectoryFromPath(path) GetFileFromPath(path) GetMetricData(monitor_name) GetProfileString(IniPath, Section, Entry) GetTempDirectory() GetTempFile(dir, prefix) GetTemplatePath() SetProfileString(IniPath, Section, Entry, Value)
16
Quick Reference to CFML
Other functions
AuthenticatedUser() AuthenticatedContext() CreateObject("COM", class or progid, "INPROC or LOCAL or REMOTE ", , servername) CreateObject("CORBA", filename or naming_context_name, IOR or naming_service, int_orb_args, ) CreateObject("JAVA", classname) CreateUUID() Decrypt(encrypted_string, key) DeleteClientVariable("name") Encrypt(string, key) GetBaseTagData(tagname [, instancenumber ] ) GetBaseTagList() GetClientVariablesList() GetFunctionList() GetTickCount() ParameterExists(parameter) PreserveSingleQuotes(variable) URLDecode(URL_encoded_string) URLEncodedFormat(string) WriteOutput(string) XMLFormat(string)
Deprecated. 17
Quick Reference to CFML
ColdFusion Variables
ColdFusion returns a wide variety of variables, such as those returned in a CFDIRECTORY or CFFTP operation. Variables are usually referenced by "scoping" the variable according to its type, as in Session. varname, or Application. varname.
Variable scope
ColdFusion supports the Variables scope. Unscoped variables created with the CFSET tag acquire the Variables scope by default. For example, the variable created by:
<CFSET linguist = Chomsky>
can be referenced as:
#Variables. linguist#
Client variables
These client variables are read-only.
Client. CFID Client. CFToken Client. HitCount Client. LastVisit Client. TimeCreated Client. URLToken
Server variables
Use the Server. prefix to reference server variables:
Server. ColdFusion. ProductName Server. ColdFusion. ProductVersion Server. ColdFusion. ProductLevel Server. ColdFusion. SerialNumber Server. ColdFusion. SupportedLocales Server. OS. Name Server. OS. AdditionalInformation Server. OS. Version Server. OS. BuildNumber
Application and session variables
Use CFAPPLICATION to enable application and session variables. They are referenced as:
Application. myvariable Session. myvariable
Use CFLOCK to ensure that modifications to shared data occur one after another. The predefined application and session variables are:
Application. ApplicationName Session. CFID Session. CFToken Session. URLToken 18 Quick Reference to CFML
Custom tag variables
Any ColdFusion custom tag returns the following variables:
ThisTag. ExecutionMode ThisTag. HasEndTag ThisTag. GeneratedContent ThisTag. AssocAttribs[index]
A custom tag can also set a Caller variable to provide information to the caller. The Caller variable is set as follows:
<CFSET Caller. variable_name = "value">
The calling page can access the variable with the <CFOUTPUT> tag:
<CFOUTPUT>#Caller. variable_name#</CFOUTPUT>
Request variable
Request variables store data that pertains to the processing of a single page request. Request variables allow you to store data in a structure that can be passed to nested tags, such as Custom Tags, and processed once. The Request variable is set as follows:
<CFSET Request. field_name1 = "value"> <CFSET Request. field_name2 = "value"> <CFSET Request. field_name3 = "value"> . . .
Each nested tag can access the variable with the <CFOUTPUT> tag:
<CFOUTPUT>#Request. field_name1#</CFOUTPUT>
Form variable
ColdFusion supports the Form variable FieldNames. You can use it on the action page associated with a form.
Form. FieldNames
Quick Reference to CFML
19
ColdFusion Tag-Specific Variables
A number of ColdFusion tags return data as variables. For example, the CFFILE tag returns file size information in the FileSize variable, referenced as CFFILE. FileSize. The following tags return data that can be referenced in variables: · CFCATCH · CFDIRECTORY · CFERROR · CFFILE · CFFTP · CFHTTP · CFINDEX · CFLDAP · CFMAIL · CFPOP · CFQUERY · CFREGISTRY · CFSEARCH · CFSERVLET · CFSTOREDPROC
ColdFusion query variables
Any ColdFusion tag that returns a query object supports the following variables:
queryname. CurrentRow queryname. RecordCount queryname. ColumnList
Where queryname is the value of the NAME attribute in each tag.
CFCATCH variables
Within a CFCATCH block, the properties of the active exception can be accessed as variables:
CFCATCH. Type CFCATCH. Message CFCATCH. Detail CFCATCH. ErrNumber CFCATCH. NativeErrorCode CFCATCH. SQLState CFCATCH. LockName CFCATCH. LockOperation CFCATCH. MissingFileName CFCATCH. TagContext CFCATCH. ErrNumber CFCATCH. ErrorCode CFCATCH. ExtendedInfo
20
Quick Reference to CFML
CFDIRECTORY variables
When used with ACTION=LIST, CFDIRECTORY returns a query object. Queryname is the value of the NAME attribute used in the CFDIRECTORY operation.
queryname. Name queryname. Size queryname. Type queryname. DateLastModified queryname. Attributes queryname. Mode
CFERROR variables
When CFERROR generates an error page, the following error variables are available if you have specified TYPE="Request", TYPE="Exception" or TYPE="Monitor. "
Error. Diagnostics Error. MailTo Error. DateTime Error. Browser Error. GeneratedContent Error. RemoteAddress Error. HTTPReferer Error. Template Error. QueryString
The following error variables are available if you have specified TYPE="Validation. "
Error. ValidationHeader Error. InvalidFields Error. ValidationFooter
In addition, any of the CFCATCH variables that apply to the exception type can be accessed within the Error scope.
Error. Type Error. Message Error. Detail Error. ErrNumber Error. NativeErrorCode Error. SQLState Error. LockName Error. LockOperation Error. MissingFileName Error. TagContext Error. ErrorCode Error. ExtendedInfo
NOTE: You can substitute the prefix CFERROR for Error if you have specified the type as "Exception" or "Monitor"; for example, CFERROR. Diagnostics, CFERROR. Mailto or CFERROR. DateTime.
Quick Reference to CFML
21
CFFILE ACTION=Upload variables
File variables are read-only. [. . . ] NOTE: The CGI variables that are available for your use vary with the Web server and configuration. Some of the following variables may not be available to you.
Request
CGI. AUTH_TYPE CGI. CONTENT_LENGTH CGI. CONTENT_TYPE CGI. PATH_INFO CGI. PATH_TRANSLATED CGI. QUERY_STRING CGI. REMOTE_ADDR CGI. REMOTE_HOST CGI. REMOTE_USER CGI. REQUEST_METHOD CGI. SCRIPT_NAME
Server
CGI. GATEWAY_INTERFACE CGI. SERVER_NAME CGI. SERVER_PORT CGI. SERVER_PROTOCOL CGI. SERVER_SOFTWARE
Client
CGI. CERT_ISSUER CGI. CERT_SUBJECT CGI. CLIENT_CERT_ENCODED CGI. HTTP_ACCEPT CGI. HTTP_IF_MODIFIED_SINCE CGI. HTTP_USER_AGENT
NOTE: The CERT_ISSUER, CERT_SUBJECT, CLIENT_CERT_ENCODED variables are available only if you are using client certificates.
Quick Reference to CFML
25
ColdFusion Studio Keyboard Shortcuts
Studio offers a full set of keyboard commands for its tools and functions. The listing below generally matches the order of the menu commands, with related shortcuts added. You can change shortcut key combinations and add new ones by opening the Options > Customize dialog and selecting the Keyboard Shortcuts tab.
File and Document Keyboard Shortcuts File and Document Shortcuts Command
File > Open File > Save File > Save As File > Close File > Close All File > Print Open default template Insert Code Template text/ open list Edit > Undo Edit > Redo Edit > Repeat Last Tag Edit > Cut Edit > Copy Edit > Paste Edit > Select All Edit > Indent Edit > Unindent Edit > Toggle Bookmark Edit > Goto Next Bookmark Edit > Goto line Goto previous document Goto next document
Key
Ctrl + O Ctrl + S Shift + Ctrl + S Ctrl + W Shift + Ctrl + W Ctrl + P CTRL + N Ctrl + J
Ctrl + Z Shift + Ctrl + Z Ctrl + Q Ctrl + X Ctrl + C Ctrl + V Ctrl + A Shift + Ctrl + . [. . . ]