background image

URLDecode

897

URLDecode

Description

Decodes a URL-encoded string. 

Returns

A copy of a string, decoded.

Category

Conversion functions

Other functions

String functions

Function syntax

URLDecode

(

urlEncodedString[, charset]

)

See also

URLEncodedFormat

; “Tags and functions for globalizing” in Chapter 17, “Developing Globalized 

Applications,” in 

ColdFusion MX Developer’s Guide

ColdFusion MX 6.1: Changed the default charset: the default charset is the character encoding of 
the URL scope.

ColdFusion MX: 

Changed Unicode support: ColdFusion supports the Java UCS-2 representation of Unicode 
character values 0–65535. (Earlier releases supported ASCII values.) 

Added the 

charset

 parameter.

Parameters

Parameter

Description

urlEncodedString

URL-encoded string or a variable that contains one.

charset

The character encoding in which the URL is encoded. Optional.
The following list includes commonly used values:

utf-8

iso-8859-1 

windows-1252

us-ascii

shift_jis

iso-2022-jp 

euc-jp

euc-kr

big5

euc-cn

utf-16

For more information on character encoding, see:

 

www.w3.org/International/O-charset.html.

 

The default value is the character encoding of the URL scope. See 

SetEncoding

.

Содержание COLFUSION MX 7 - INSTALLING AND USING COLDFUSION MX

Страница 1: ...COLDFUSION MX7 CFML Reference...

Страница 2: ...uide then you do so at your own risk Macromedia provides these links only as a convenience and the inclusion of the link does not imply that Macromedia endorses or accepts any responsibility for the c...

Страница 3: ...936 Styles for cfformgroup with horizontal or vertical type atributes 936 Styles for box style cfformgroup elements 937 Styles for cfformgroup with accordion type attribute 938 Styles for cfformgroup...

Страница 4: ...eference 1055 C class overview 1055 Deprecated class methods 1056 CCFXException class 1056 CCFXQuery class 1058 CCFXRequest class 1062 CCFXStringSet class 1072 CHAPTER 8 ColdFusion Java CFX Reference...

Страница 5: ...s how to manage the ColdFusion environment including connecting to your data sources and configuring security for your applications Part II describes Verity search tools and utilities that you can use...

Страница 6: ...ne documentation All ColdFusion MX documentation is available online in HTML and Adobe Acrobat Portable Document Format PDF files Go to the documentation home page for ColdFusion MX on the Macromedia...

Страница 7: ...can be used safely in some situations you can prevent errors by avoiding them entirely Any name starting with cf However when you call a CFML custom tag directly you prefix the custom tag page name wi...

Страница 8: ...ds that you cannot use as variable names in queries to their databases For a detailed list see your DBMS documentation ABSOLUTE ACTION ADD ALL ALLOCATE ALTER AND ANY ARE AS ASC ASSERTION AT AUTHORIZAT...

Страница 9: ...ECT INTERVAL INTO IS ISOLATION JOIN KEY LANGUAGE LAST LEADING LEFT LEVEL LIKE LOCAL LOWER MATCH MAX MIN MINUTE MODULE MONTH NAMES NATIONAL NATURAL NCHAR NEXT NO NOT NULL NULLIF NUMERIC OCTET_LENGTH OF...

Страница 10: ...Client variables The following client variables are reserved Client CFID Client CFToken Client HitCount Client LastVisit Client TimeCreated Client URLToken Server variables Use the Server prefix to re...

Страница 11: ...st Request variables store data in a structure that can be passed to nested tags such as custom tags and processed once To provide information to nested tags set a Request variable as follows CFSET Re...

Страница 12: ...Type CFCATCH Message CFCATCH Detail CFCATCH ErrNumber CFCATCH NativeErrorCode CFCATCH SQLState CFCATCH LockName CFCATCH LockOperation CFCATCH MissingFileName CFCATCH TagContext CFCATCH ErrorCode CFCAT...

Страница 13: ...Time Error Browser Error GeneratedContent Error RemoteAddress Error HTTPReferer Error Template Error QueryString The following error variables are available if type validation Error ValidationHeader E...

Страница 14: ...verFileExt CFFILE ServerFileName CFFILE TimeCreated CFFILE TimeLastModified CFFTP error variables When you use the cfftp stoponerror attribute these variables are populated CFFTP Succeeded CFFTP Error...

Страница 15: ...e ColumnList CFPOP variables The cfpop tag returns the following result columns depending on the action attribute value and the use of other attributes such as attachmentpath where queryname is the na...

Страница 16: ...value searchname URL searchname Key searchname Title searchname Score searchname Custom1 and Custom2 searchname Summary searchname RecordCount searchname CurrentRow searchname RecordsSearched searchna...

Страница 17: ...erver API or CGI to communicate with the ColdFusion server Environment variables contain data about the transaction between the browser and the server such as the IP Address browser type and authentic...

Страница 18: ...is path The extra information is sent as PATH_INFO PATH_TRANSLATED Translated version of PATH_INFO after any virtual to physical mapping SCRIPT_NAME Virtual path to the script that is executing used f...

Страница 19: ...sponse to the server having sent the LAST_MODIFIED HTTP header It can be used to take advantage of browser side caching CGI client certificate variable Description CERT_SUBJECT Client specific informa...

Страница 20: ...20 Chapter 1 Reserved Words and Variables...

Страница 21: ...owing table briefly describes CFML tags CFML tag Category Description cfabort Flow control tags Stops the processing of a ColdFusion page at the tag location cfapplet Forms tags Embeds Java applets in...

Страница 22: ...rol tags Receives control if there is no matching cfcase tag value cfdirectory File management tags Performs typical directory handling tasks from within a ColdFusion application cfdocument Data outpu...

Страница 23: ...text and HTML to HEAD section of page cfhttp Internet Protocol tags Performs GET and POST to upload file or post form cookie query or CGI variable directly to server cfhttpparam Internet Protocol tag...

Страница 24: ...e cfNTauthenticate Security tags Authenticates user information against an NT domain cfobject Extensibility tags Creates COM component CORBA Java and web service objects cfobjectcache Database manipul...

Страница 25: ...ags Creates a drop down list box form element used in cfform tag cfset Variable manipulation tags Defines a variable cfsetting Other tags Variable manipulation tags Defines and controls ColdFusion set...

Страница 26: ...28 Other tags 29 Application framework tags cftree Forms tags Creates tree control element used in cfform cftreeitem Forms tags Populates a tree control element in a form used with cftree cftry Excep...

Страница 27: ...entitem cfoutput cfchartdata cfdocumentsection cfprocessingdirective cfchartseries cfflush cfreport cfcol cfheader cfreportparam cfcontent cflog cfsilent cfdocument cfoutput cftable cfdump cftimer cft...

Страница 28: ...ation cfelseif cfloop cfapplet cfgrid cfselect cfcalendar cfgridcolumn cfslider cfform cfgridrow cftextarea cfformgroup cfgridupdate cftree cfformitem cfinput cftreeitem cfftp cfldap cfmailpart cfhttp...

Страница 29: ...g Attribute or value Added in this ColdFusion release cfapplication scriptProtect ColdFusion MX 7 loginStorage ColdFusion MX 6 1 cfargument xml value of type attribute ColdFusion MX 7 All ColdFusion M...

Страница 30: ...esult attribute for upload action ColdFusion MX 7 fixnewline attribute for action append and action write cfform name and action attributes are optional ColdFusion MX 7 accessible format height width...

Страница 31: ...pdate Refresh Delete Purge actions New values of the language attribute cfinput height and width attributes all except checkbox and radiobutton ColdFusion MX 7 bind attribute text and password label a...

Страница 32: ...attribute ColdFusion MX 6 1 cfmailpart All ColdFusion MX 6 1 cfNTauthenticate All ColdFusion MX 7 cfobject All ColdFusion MX cfobjectcache All ColdFusion MX cfparam min max pattern attributes ColdFusi...

Страница 33: ...oldFusion MX 7 enabled group height label onKeyUp onKeyDown onMouseUp onMouseDown onChange onClick queryPosition tooltip visible and width attributes cfsetting requestTimeOut attribute ColdFusion MX c...

Страница 34: ...through attribute ColdFusion MX 7 enableCAB attribute ColdFusion MX cfftp agentname attribute ColdFusion MX cfgraph All ColdFusion MX cfgraphdata All ColdFusion MX cfgridupdate connectString dbName db...

Страница 35: ...ut All ColdFusion MX 7 cfupdate connectString dbName dbServer dbtype provider providerDSN attributes ColdFusion MX Tag Attribute or value Obsolete as of this ColdFusion release cfauthenticate All Cold...

Страница 36: ...reached and ColdFusion returns the page contents up to the line that contains the cfabort tag When you use this tag with the showError attribute but do not define an error page using cferror page proc...

Страница 37: ...value cfloop from 1 to 4 index Counter on the second time through the loop cfabort cfif Counter is 2 Take out the cferror line to see cfabort error processed by CF error page cferror type request tem...

Страница 38: ...r_nonJava_browser param_1 applet_parameter_name param_2 applet_parameter_name param_n applet_parameter_name See also cfform cfformgroup cfformitem cfgrid cfinput cfobject cfselect cfservlet cfslider c...

Страница 39: ...the ColdFusion Administrator and click Applets link under extensions section p This example applet copies text that you type into a form Type some text and then click copy to see the copied text cffor...

Страница 40: ...CFC Reference on page 945 Chapter 13 Designing and Optimizing a ColdFusion Application and Chapter 37 Integrating J2EE and Java Elements in CFML Applications in ColdFusion MX Developer s Guide History...

Страница 41: ...omputer in a cookie Scalable If client disables cookies in the browser client variables do not work setClientCookies Optional yes yes enables client cookies no ColdFusion does not automatically send C...

Страница 42: ...application to send malicious code back to a user s browser In these attacks user input for example from form fields or from URL variables sets a CF variable which is destined for user output The subm...

Страница 43: ...CrossSiteScriptPatterns variable Locking server application and session variables When you set or update variables in the server application and session scopes use the cflock tag with the scope attri...

Страница 44: ...s variable keeps track of total number of turtlenecks sold cflock scope Application timeout 30 type Exclusive cfset application number application number session numPurchased cflock cfif cfoutput E Tu...

Страница 45: ...ment any array binary boolean date guid the argument must be a UUID or GUID of the form xxxxxxxx xxxx xxxx xxxx xxxxxxxxxxxx where each x is a character representing a hexadecimal number 0 9A F numeri...

Страница 46: ...datasource cfdocexamples SELECT Descript FROM Courses WHERE Number Course_Number cfquery Specify the variable that the function returns cfreturn Description Descript cffunction required Optional no No...

Страница 47: ...me in the dataCollection attribute The structure is appended to an array whose name is thistag collectionName Within the custom tag code the attributes passed to the tag by using the attributeCollecti...

Страница 48: ...This tag is obsolete Use the newer security tools see Conversion functions on page 453 and Chapter 16 Securing Applications in ColdFusion MX Developer s Guide History ColdFusion MX this tag is obsole...

Страница 49: ...DER by course_number cfquery p This example uses CFLOOP to cycle through a query to find a value In our example a list of values corresponding to courses in the Snippets datasource When the conditions...

Страница 50: ...50 Chapter 2 ColdFusion Tags cfelse br Searching cfif cfloop cfif...

Страница 51: ...rectory and timeout attributes They might not work and might cause an error in later releases Added the timespan attribute Changed how pages are cached the default action attribute value cache caches...

Страница 52: ...n servercache server side caching only Not recommended optimal same as cache directory Optional cf_root cache Absolute path of cache directory timespan Optional Page is flushed only whencfcache action...

Страница 53: ...ting a cached file cfcache uses cfsetting showDebugOutput no The cfcache tag evaluates each unique URL including URL parameters as a distinct page for caching purposes For example the output of http s...

Страница 54: ...tionscript to invoke See also cfform cfgrid cfinput cfselect cfslider cftextarea cftree About Flash form styles in Chapter 29 Creating Forms in Macromedia Flash in ColdFusion MX Developer s Guide Hist...

Страница 55: ...acters Any other character put the character in the specified location For more information on masking see Masking input data in the cfinput reference page firstDayOfWeek Optional 0 Integer in the ran...

Страница 56: ...e in a month respectively Use the Page Up and Page Down keys to reach the previous and next month respectively Note The cfcalendar tag is not supported in XML format forms Example This example produce...

Страница 57: ...75 height 350 cfcalendar name selectedDate selectedDate Form selectdate startRange Form startdate endRange Form enddate mask mmm dd yyyy dayNames SU MO TU WE TH FR SA monthNames JAN FEB MAR APR MAY JU...

Страница 58: ...ching values with the delimiter character which is the comma by default For example the following line matches red blue or green cfcase value red blue green You can use the delimiter attribute to spec...

Страница 59: ...e 10 cfset grade A cfcase cfcase value 9 8 delimiters cfset grade B cfcase cfcase value 7 6 delimiters cfset grade C cfcase cfcase value 5 4 delimiters cfset grade D cfcase cfdefaultcase cfset grade F...

Страница 60: ...value is the same as in ColdFusion 5 Type 4 100 Java no native methods the value might be different If your application depends on SQLSTATE values for flow control the application might produce unexp...

Страница 61: ...hing exception type starting with the most specific the entire string and ending with the least specific For example you could define a type as follows cfthrow type MyApp BusinessRuleException Invalid...

Страница 62: ...resenting one level of the active tag context at the time of the exception cfcatch NativeErrorCode Applies to type database Native error code associated with exception Database drivers typically provi...

Страница 63: ...Allaire ColdFusion HTTPContinue COM Allaire ColdFusion HTTPCookieValueNotPassed COM Allaire ColdFusion HTTPCreated COM Allaire ColdFusion HTTPFailure COM Allaire ColdFusion HTTPFileInvalidPath COM Al...

Страница 64: ...uired COM Allaire ColdFusion HTTPPreconditionFailed COM Allaire ColdFusion HTTPProxyAuthenticationRequired COM Allaire ColdFusion HTTPRequestURITooLarge COM Allaire ColdFusion HTTPResetContent COM All...

Страница 65: ...cfcatch 65 p Caught an exception type CFCATCH TYPE p p The contents of the tag stack are p cfdump var cfcatch tagcontext cfoutput cfcatch cftry...

Страница 66: ...old yes or no fontItalic yes or no fontSize integer font size foregroundColor Hex value or Web color format flash or jpg or png gridlines integer number of lines labelFormat number currency percent da...

Страница 67: ...rt border around labels and around the legend Hexadecimal value or supported named color see the name list in Usage For a hexadecimal value use the form xxxxxx or xxxxxxxx where x 0 9 or A F use two n...

Страница 68: ...xis including axis positive integer labelFormat Optional number Format for y axis labels number currency percent date markerSize Optional Automatic Size of data point marker in pixels integer name Opt...

Страница 69: ...a points in line curve and scatter graphs yes no showXGridlines Optional no Whether to display x axis gridlines yes no showYGridlines Optional yes Whether to display y axis gridlines yes no sortXAxis...

Страница 70: ...the label of the selected item If none the value is an empty string SERIESLABEL the label of the selected series If none the value is an empty string For example somepage cfm item ITEMLABEL series SE...

Страница 71: ...render a double byte character set you must select this value If this value is selected the fontBold and fontItalic attributes have no effect The following table lists W3C HTML 4 named color value or...

Страница 72: ...docexamples database and generates a bar chart showing average salary by department The body of the cfchartseries tag includes one cfchartdata tag to include data that is not available from the query...

Страница 73: ...Bar graph from Query of Queries cfchart format flash xaxistitle Department yaxistitle Salary Average cfchartseries type bar query DataTable itemcolumn Dept_Name valuecolumn avgSal cfchartdata item Fac...

Страница 74: ...tment The body of the cfchartseries tag loops over a cfchartdata tag to include data available from the query Get the raw data from the database cfquery name GetSalaries datasource cfdocexamples SELEC...

Страница 75: ...1000 cfset DataTable avgSal i Round DataTable avgSal i 1000 1000 cfloop h1 Employee Salary Analysis h1 Bar graph from Query of Queries cfchart format flash xaxistitle Department yaxistitle Salary Aver...

Страница 76: ...aise shade light query queryName seriesColor Hex value or Web color seriesLabel Label Text type type valueColumn queryColumn dataLabelStyle style cfchartseries See also cfchart cfchartdata Chapter 31...

Страница 77: ...al rectangle Sets the icon that marks a data point for two dimensional line curve and scatter graphs rectangle triangle diamond circle letter mcross snow rcross paintStyle Optional plain Sets the pain...

Страница 78: ...ECT Departmt Dept_Name Employee Dept_ID Employee Salary FROM Departmt Employee WHERE Departmt Dept_ID Employee Dept_ID cfquery type Required Sets the chart display style bar line pyramid area horizont...

Страница 79: ...GetSalaries GROUP BY Dept_Name cfquery Reformat the generated numbers to show only thousands cfloop index i from 1 to DataTable RecordCount cfset DataTable sumSal i Round DataTable sumSal i 1000 1000...

Страница 80: ...able tags To display the cfcol header text you must specify the cfcol header and the cftable colHeader attribute If you specify either attribute without the other the header does not display No error...

Страница 81: ...l Example h3 Uses the HTMLTable attribute to display cftable as an HTML table rather than PRE formatted information cftable query GetEmployees startRow 1 colSpacing 3 HTMLTable colheaders Each cfcol t...

Страница 82: ...ction Added CATEGORIES SIZE DOCCOUNT and LASTMODIFIED to list of variables returned by the list action Marked as obsolete the MAPPED ONLINE and REGISTERED variables returned by the list action ColdFus...

Страница 83: ...tered by ColdFusion map creates a map to a collection If the action is create and the collection already exists Coldfusion also creates a map to the collection optimize optimizes the structure and con...

Страница 84: ...equired Required language Optional Optional name Required Required categories CATEGORIES blue 10 green 3 magenta 3 purple 2 CATEGORYTREES a 10 a b 10 a b c 10 a b c subdir 3 Column Contents CATEGORIES...

Страница 85: ...collections that are registered with the Verity server use code such as the following cfcollection action list name myCollections cfoutput query myCollections name br cfoutput To add content to a col...

Страница 86: ...cfelse cfset collpath opt coldfusionmx7 verity collections cfif Process form input and do the requested cfcollection operation cfif IsDefined form CollectionName AND IsDefined form CollectionAction c...

Страница 87: ...CollectionAction option value Create Create this collection option value Optimize Optimize this collection option value Repair Repair this collection option value Delete Delete this collection select...

Страница 88: ...on page Within a URL that calls a CFC file and passes a method name as a URL parameter Within the cfscript tag As a web service From Flash code Category Extensibility tags Syntax cfcomponent extends a...

Страница 89: ...a cfoutput tag Variable names surrounded by number signs are automatically replaced with their values no Constructor code is processed as if it were within a cfsilent tag If you do not specify this at...

Страница 90: ...only when style document bindingname Optional Specifies the binding attribute of the port element in the WSDL If you don t specify this attribute ColdFusion MX derives the value from the CFC class na...

Страница 91: ...empQuery datasource cfdocexamples SELECT FIRSTNAME LASTNAME EMAIL FROM tblEmployees cfquery cfreturn empQuery cffunction cffunction name getDept cfquery name deptQuery datasource cfdocexamples SELECT...

Страница 92: ...he contents of a file or of a variable that contains binary data as the page output To restrict this tag use the Sandbox Security feature of the ColdFusion MX Administrator For more information see th...

Страница 93: ...iso 8859 1 windows 1252 us ascii shift_jis iso 2022 jp euc jp euc kr big5 euc cn utf 16 For example type text html type text html charset ISO 8859 1 deleteFile Optional no Applies only if you specify...

Страница 94: ...ts of the file specified by the cfcontent tag using the filename specified by the filename value If the user selects to open the file most browsers open the file in the related application not the bro...

Страница 95: ...t see www iana org assignments media types Example CFCONTENT Example 1 This example shows the use of cfcontent to return the contents of the CF Documentation page dynamically to the browser You might...

Страница 96: ...EXAMPLE 5 This example causes the browser to treat the HTML table as Excel data Excel interprets the table format Because Excel can include executable code the browser prompts the user whether to sav...

Страница 97: ...d Name of cookie variable ColdFusion converts cookie names to all uppercase Cookie names set using this tag can include any printable ASCII characters except commas semicolons or white space character...

Страница 98: ...ie set in the preceding code use the following line cfoutput cookie person name cfoutput secure Optional If browser does not support Secure Sockets Layer SSL security the cookie is not sent To use the...

Страница 99: ...u match the string aol com in a visitor s e mail address cfloop query GetAolUser cfif FindNoCase aol com Email 1 is not 0 cfcookie name LastAOLVisitor value Email expires NOW cfif cfloop If the timeVi...

Страница 100: ...h any of the values specified by the cfcase tags in the cfswitch tag body The contents of the cfdefaultcase tag body can include HTML and text and CFML tags functions variables and expressions You can...

Страница 101: ...cfdefaultcase 101 cfdefaultcase cfswitch cfoutput Your grade is grade cfoutput...

Страница 102: ...also cffile History ColdFusion MX 7 Added the recurse attribute named recursive in Alpha 1 and directory result set column ColdFusion MX Changed behavior for action list On Windows cfdirectory action...

Страница 103: ...returned names for example cfm One filter can be applied mode Optional Used with action create Permissions Applies only to UNIX and Linux Octal values of chmod command Assigned to owner group and oth...

Страница 104: ...llowing result columns in standard CFML expressions preceding the result column name with the query name mydirectory name mydirectory directory mydirectory size mydirectory type mydirectory dateLastMo...

Страница 105: ...ory Check that the directory exists and that files are not in the directory to avoid getting ColdFusion error messages cfset currentDirectory GetDirectoryFromPath GetTemplatePath otherNewDir Check to...

Страница 106: ...hat contains entries for the directories only cfdirectory directory C temp name dirQuery action LIST Get an array of directory names cfset dirsArray arraynew 1 cfset i 1 cfloop query dirQuery cfif dir...

Страница 107: ...marginright number unit in or cm encryption 128 bit or 40 bit or none ownerpassword password userpassword password permissions permission list fontembed yes or no backgroundvisible yes or no scale per...

Страница 108: ...in centimeters include the unit cm attribute pagewidth Optional Specifies the page width in inches default or centimeters This attribute is only valid if pagetype custom To specify page width in centi...

Страница 109: ...permissions AllowPrinting AllowModifyContents AllowCopy AllowModifyAnnotations AllowFillIn AllowScreenReaders AllowAssembly AllowDegradedPrinting Separate multiple permissions with a comma fontembed...

Страница 110: ...count Note The cfdocument scope variables are reserved for page number rendering Do not use them in ColdFusion expressions For example the following code does not work cfif cfdocument currentpagenumbe...

Страница 111: ...on History ColdFusion MX 7 Added this tag Attributes Usage Use the cfdocumentitem tag to control the formatting of a PDF or FlashPaper report This tag must be wrapped inside a cfdocument cfdocument pa...

Страница 112: ...document it applies to the rest of the document If the tag is at the end of the document it has no affect With cfdocumentsection tags The cfdocumentitem attribute applies only to the section and over...

Страница 113: ...tributes Attribute Req Opt Default Description margintop Optional Specifies the top margin in inches default or centimeters To specify the top margin in centimeters include the unit cm attribute in th...

Страница 114: ...ry SELECT Emp_ID firstname lastname e dept_id salary d dept_name FROM employee e departmt d WHERE e dept_id d dept_id ORDER BY d dept_name cfquery cfdocument format PDF cfoutput query empSalary group...

Страница 115: ...cfdocumentsection 115 cfdocumentsection cfoutput cfdocument...

Страница 116: ...tory ColdFusion MX 7 Added the top attribute ColdFusion MX 6 1 Added the ability to dump COM objects it displays the methods and Get and Put properties typeinfo information for the object Attributes A...

Страница 117: ...splay a construct use code such as the following in which myDoc is a variable of type XmlDocument cfif IsXmlDoc mydoc is yes cfdump var mydoc cfif The tag output is color coded according to data type...

Страница 118: ...ression HTML and CFML tags cfelse HTML and CFML tags cfif See also cfif cfelseif cfabort cfbreak cfexecute cfexit cflocation cfloop cfswitch cfthrow cftry Usage If the values of the expressions in the...

Страница 119: ...e cfexit cflocation cfloop cfswitch cfthrow cftry Usage If the value of the expression in this tag is true and the values of the expressions in the containing cfif tag and preceding cfelseif tags are...

Страница 120: ...recated the monitor option of the exception attribute It might not work and might cause an error in later releases Attributes Attribute Req Opt Default Description type Required Type of error that the...

Страница 121: ...specify and code you can use on the pages that handle these error type mailTo Optional An e mail address This attribute is available on the error page as the variable error mailto ColdFusion does not...

Страница 122: ...ns as in Error InvalidFields You must specify the validation error handler in the Application cfc or Application cfm file Handles hidden form field or onSubmit format validation errors only Page type...

Страница 123: ...ontact error mailTo with the following information p p ul li b Your Location b error remoteAddress li b Your Browser b error browser li b Date and Time the Error Occurred b error dateTime li b Page Yo...

Страница 124: ...is relative to the ColdFusion temporary directory Attributes Attribute Req Opt Default Description name Required Absolute path of the application to execute On Windows you must specify an extension fo...

Страница 125: ...outputfile or variable attribute is specified output is displayed on the page from which it was called If not an absolute path starting a with a drive letter and a colon or a forward or backward slas...

Страница 126: ...age it executes in the same way as cfabort The cfexit tag can help simplify error checking and validation logic in custom tags The cfexit tag function depends on its location and execution mode Attrib...

Страница 127: ...efined the tag adds them and returns the result to the calling page in the variable result If either or both of the expected attribute variables is not present an error message is generated and cfexit...

Страница 128: ...and Administering ColdFusion MX Category File management tags Syntax The tag syntax depends on the action attribute value See the following sections See also cfdirectory History ColdFusion MX 7 Added...

Страница 129: ...ttribute options read write append and move they support a new attribute charset The archive value of the attributes attribute is obsolete and has no effect Example This shows how to write read update...

Страница 130: ...it read from it or delete it p cfif If reading from a form let that information display in textarea textarea name the_text cols 40 rows 5 cfif readText is not cfoutput readText cfoutput cfif textarea...

Страница 131: ...file to which to append content of output attribute If not an absolute path starting a with a drive letter and a colon or a forward or backward slash it is relative to the ColdFusion temporary directo...

Страница 132: ...attributes readOnly all other attributes are overwritten readOnly hidden normal charset Optional JVM default file character set The character encoding in which the file contents is encoded The followi...

Страница 133: ...s returned by the GetTempDirectory function destination Required Pathname of a directory or file on web server where the file will be copied If you specify a filename without a directory path ColdFusi...

Страница 134: ...134 Chapter 2 ColdFusion Tags Example This example copies the keymemo doc file to the c files backup directory cffile action copy source c files upload keymemo doc destination c files backup...

Страница 135: ...file action delete file c files upload Variables DeleteFileName Attribute Req Opt Default Description action Required Type of file manipulation that the tag performs file Required Pathname of the file...

Страница 136: ...urce Required Pathname of the file to move If not an absolute path starting a with a drive letter and a colon or a forward or backward slash it is relative to the ColdFusion temporary directory which...

Страница 137: ...omitted the file s attributes are maintained Each value must be specified explicitly For example if you specify attributes readOnly all other attributes are overwritten readOnly hidden normal charset...

Страница 138: ...ntended for use with large files such as logs because this can bring down the server Syntax cffile action read file full_path_name variable var_name charset charset_option See also cfdirectory History...

Страница 139: ...is Cp1252 and the files has characters encoded in the Hex 8x or 9x range you must specify charset windows 1252 attribute even though this is the default encoding Otherwise some characters in the Hex8x...

Страница 140: ...r site Example The following example reads the binary file somewhere jpg writes it to a different folder as somewhereB jpg and then displays the new file cffile action readBinary file C inetpub wwwroo...

Страница 141: ...te path starting a with a drive letter and a colon or a forward or backward slash it is relative to the ColdFusion temporary directory which is returned by the GetTempDirectory function destination Re...

Страница 142: ...ut when renamed it becomes normal not hidden or read only cffile action rename source c files memo readonlymemo doc destination c files memo normalmemo doc attributes normal Unix Example cffile action...

Страница 143: ...to upload the file If not an absolute path starting a with a drive letter and a colon or a forward or backward slash it is relative to the ColdFusion temporary directory which is returned by the GetT...

Страница 144: ...th of any other request content The following file upload status parameters are available after an upload mode Optional Applies only to UNIX and Linux Permissions Octal values of chmod command Assigne...

Страница 145: ...on the client system without an extension contentSubType MIME content subtype of the saved file contentType MIME content type of the saved file dateLastAccessed Date and time the uploaded file was las...

Страница 146: ...ype of file manipulation that the tag performs file Required Pathname of the file to write If not an absolute path starting a with a drive letter and a colon or a forward or backward slash it is relat...

Страница 147: ...comma delimited list of attributes to set on the file If omitted the file s attributes are maintained Each value must be specified explicitly For example if you specify attributes readOnly all other...

Страница 148: ...eldname destination tmp program exe mode 777 This example uses the fixnewline attribute to changes embedded line ending characters in xmlString which is derived from xmlData to operating system specif...

Страница 149: ...ctions on a page anywhere after the cfflush tag can cause errors or unexpected results cfcontent cfcookie cfform cfheader cfhtmlhead cflocation and SetLocale These tags and functions normally modify t...

Страница 150: ...at truly fit your personality So relax for a minute or so while we do the hard work for you p H2 We are sure you will agree it was worth the short wait H2 cfflush cfflush interval 10 Delay Loop to mak...

Страница 151: ...ash and XML only width pixels or percent height pixels or percent The following attributes are supported in Flash only onError ActionScript code wMode window or transparent or opaque accessible yes or...

Страница 152: ...ll supported HTML attributes in the XML Attribute Applies to Req Opt Default Description name HTML Flash XML Opt CFForm_n A name for the form In HTML format if you omit this attribute and specify an i...

Страница 153: ...L Specfies whether to apply an XSL skin and display the resulting HTML to the client Can be any of the following ColdFusion MX skin name applies the specified skin XSL file name applies the skin locat...

Страница 154: ...ider cftextinput overrides the value attribute value cfselect controls that are populated from queries Overrides the selected attribute See cfselect cftree controls overrides the cftreeitem expand att...

Страница 155: ...le JRE plug in for Internet Explorer used for cfgrid cfslider and cftree Java applet controls Default CFIDE classes cf j2re win cab archive applets in HTML and XML Opt See Description URL of downloada...

Страница 156: ...relative to other displayable content that occupies the same space on an HTML page window the Flash form is the topmost layer on the page and obscures anything that would share the space such as drop...

Страница 157: ...you follow a Flash form with additional output specify the height and width values If attribute value text must include quotation marks escape them by doubling them Using the onError attribute in Fla...

Страница 158: ...of Radio Button Test h3 cfif Form testVal1 Your radio button answer was yes cfelse Your radio button answer was no cfif cfif h3 Results of Checkbox Test h3 cfif IsDefined Form chkTest2 Your checkbox a...

Страница 159: ...L format form It uses the default xsl transform that is supplied with ColdFusion to generate the HTML output for display cfform name testXForm format XML skin basic Use cfformgroup to put the first an...

Страница 160: ...p type repeater query query object startrow row number maxrows integer ColdFusion forms controls cfformgroup See also cfapplet cfcalendar cfform cfformitem cfgrid cfinput cfselect cfslider cftextarea...

Страница 161: ...type vertical inside this formgroup to align its child tags vertically Flash Must be one of the following repeater dynamically creates an instance of the cfformgroup s child tag or tags for each row...

Страница 162: ...ting accordion Define each pleat using a cfformgroup type page tag tabnavigator places the children in a tabbed dialog box Define each tab using a cfformgroup type page tag page places the children ta...

Страница 163: ...specifies the first page control defined in the group width Optional Flash and XML Width of the group container in pixels If you omit this attribute Flash automatically sizes the container width Igno...

Страница 164: ...oldFusion MX Developer s Guide Example For a simple example of an XML form that uses a single cfformgroup tag see cfform The following example shows how to use the cfformgroup tag to arrange elements...

Страница 165: ...tabs b br Submit the form and see what ColdFusion gets in the Forms scope b br a href http www macromedia com target _blank font color 0000FF u This link displays the Macromedia home page in a new br...

Страница 166: ...e vbox cfformitem type text height 20 Fruits cfformitem cfformgroup type tile width 200 label Tile box Flash requires unique names for all controls cfinput type Checkbox name chk1 Label Apples value A...

Страница 167: ...ls visible Yes or No enabled Yes or No tooltip Tip text bind bind expression text cfformitem See also cfapplet cfform cfformgroup cfgrid cfinput cfselect cfslider cftextarea cftree Adding text images...

Страница 168: ...hrule places a horizontal rule on the form This tag must not have any children vrule places a vertical rule on the form This tag must not have any children XML html puts the CFML tag s body text in a...

Страница 169: ...t this attribute Flash automatically sizes the width In ColdFusion XSL skins use the style attribute instead height Optional Flash Height of the item in pixels If you omit this attribute Flash automat...

Страница 170: ...file and directory operations ColdFusion MX Deprecated the agentname attribute It might not work and might cause an error in later releases Usage Use this tag to move files between a ColdFusion server...

Страница 171: ...terminates an FTP connection username Required if action open User name to pass in the FTP operation password Required if action open Password to log in the user server Required if action open FTP se...

Страница 172: ...r so close a connection as soon as possible If you do not assign the connection name to Session or Application variable the connection remains open for the current page only and you do not have to clo...

Страница 173: ...OnError Yes p Did it succeed cfoutput cfftp succeeded cfoutput p List the files in a directory cfftp action LISTDIR stopOnError Yes name ListFiles directory connection my_query cfoutput query ListFile...

Страница 174: ...File filename item directory or file existing file or directory name new file or directory name proxyServer proxy server passive yes or no result result_name See also cfhttp cfldap cfmail cfpop Attrib...

Страница 175: ...rform an operation localFile Required if action getFile or putFile Name of the file on the local file system remoteFile Required if action getFile putFile or existsFile Name of the file on the FTP ser...

Страница 176: ...le exists For more information see ColdFusion MX Developer s Guide Caution Object file and directory names are case sensitive Action cfftp ReturnValue variable The results of an action determine the v...

Страница 177: ...eader b Name b text name cfcol header b Path b text path cfcol header b URL b text url cfcol header b Length b text length cfcol header b LastModified b text DateFormat lastmodified cfcol header b IsD...

Страница 178: ...er of each file directory entry returned by the listDir operation A separate row is created for each entry Note Previously supported query column values that pertain to system specific information are...

Страница 179: ...the XML value to the returntype attribute ColdFusion MX Added this tag Category Extensibility tags Syntax cffunction name methodName returnType dataType roles securityRoles access methodAccess descrip...

Страница 180: ...xxxxxxxxxxxxxxxx where each x is a character representing a hexadecimal number 0 9A F variableName a string formatted according to ColdFusion variable naming conventions void does not return a value x...

Страница 181: ...lly or remotely executing page or component method or a remote client through a URL Flash or a web service To publish the function as a web service this option is required description Optional Supplie...

Страница 182: ...ariable name format that is the function must return a string that starts with a letter underscore or Unicode currency symbol and consist of letters numbers and underscores _ periods and Unicode curre...

Страница 183: ...hat you specify in the tag Arial is not supported it is mapped to Dialog Itemlabelfont Sets item label text font If the Valuelabelfont Itemlabelfont and Legendfont values differ ColdFusion uses the la...

Страница 184: ...alues before the URL is accessed value selected row column value or an empty string itemlabel selected item column value or an empty string serieslabel selected series row value or an empty string jav...

Страница 185: ...deprecated Use the cfchart cfchartdata and cfchartseries tags instead Displays a data point in a graph Used within the cfgraph tag History ColdFusion MX Deprecated this tag It works differently than i...

Страница 186: ...mn_font fontSize size italic yes or no bold yes or no textColor web color gridLines yes or no rowHeight pixels colHeaders yes or no colHeaderFont font_name colHeaderFontSize size colHeaderItalic yes o...

Страница 187: ...deleteButton text sortAscendingButton text sortDescendingButton text zero or more cfgridcolumn and cfgridrow tags cfgrid See also cfapplet cfcalendar cfgridcolumn cfgridrow cfgridupdate cfform cfformg...

Страница 188: ...he grid sizes automatically width Optional All 300 applet only Width of the control in pixels If you omit the attribute in Flash format the grid sizes automatically query Optional All Name of the quer...

Страница 189: ...Size of column header text in points colHeaderItalic Optional All no yes displays column headers in italics no colHeaderBold Optional All no yes displays column headers in bold no colHeaderTextColor O...

Страница 190: ...the values specified in the cfgridcolumn width attributes vSpace Optional applet Vertical space above and below the control in pixels hSpace Optional applet Horizontal space to the left and right of...

Страница 191: ...are passed to the function which must return True if validation succeeds False otherwise onError Optional applet A JavaScript function to execute if validation fails gridDataAlign Optional applet Left...

Страница 192: ...dy ColdFusion generates a grid with the following A column for each column in the query A default header for each column created by replacing hyphen or underscore characters in the table column name w...

Страница 193: ...ta available in the action page as ColdFusion variables in the Form scope with the naming convention form GridName ColumnName Each SelectMode returns these form variable s SelectMode single form GridN...

Страница 194: ...ColName cfset Array_Orig form GridName original ColName cfset Array_Action form GridName RowStatus Action cfif NOT IsArray Array_New b The form variable is not an array b br cfelse cfset size ArrayLe...

Страница 195: ...selectMode Row selection is a comma delimited list of column values in the clicked row beginning with the value of the first cell in the row If selectMode Column selection is a comma delimited list o...

Страница 196: ...bgColor web color or expression dataAlign position The following attribute applies to Flash format only mask format mask The following attribute applies to applet format only href URL hrefKey column_n...

Страница 197: ...dFusion MX passes all attributes to the XML The supplied XSLT skins do not handle or display XML format grids but do display applet and Flash format grids Attribute Req Opt Formats Default Description...

Страница 198: ...ition to paths to image files in the column values cd computer document element folder floppy fixed remote You can specify the following attribute in Flash format it does not work in applet grids curr...

Страница 199: ...ement text in column as a hexadecimal number or text name To enter a hexadecimal value use the form xxxxxx where x 0 9 or A F use two number signs or none Any color in hexadecimal format Black Red Blu...

Страница 200: ...s in mask attribute href Optional Applet URL or query column name that contains a URL to hyperlink each grid column with hrefKey Optional Applet The query column to use for the value appended to the h...

Страница 201: ...display in the drop down list Delimited strings and or numeric range s valuesDelimiter Optional Applet comma Delimiter in values and valuesDisplay attributes Character Meaning _ Underscore Digit place...

Страница 202: ...ed as numeric in one or two digits If the number of pattern letters is two the format is interpreted as numeric in two digits If the number of pattern letters is three the format is interpreted as sho...

Страница 203: ...ption information for courses i The cfform tag must surround a cfgrid control cfform action CGI SCRIPT_NAME cfgrid name FirstGrid width 500 query GetCourses colheaderbold Yes font Tahoma rowHeaders No...

Страница 204: ...mber header Course Select No width 65 cfgridcolumn name CorName header Name width 125 cfgridcolumn name CorLevel header Level width 85 cfgridcolumn name CorDesc header Description width 125 cfgrid br...

Страница 205: ...t two lists each with the data for a grid column cfset cities Rome Athens Canberra Brasilia Paris cfset countries Italy Greece Australia Brazil France cfform name cities cfgrid name GeoGrid autowidth...

Страница 206: ...cfapplet cfinput cfselect cfslider cftextinput cftree History ColdFusion MX Deprecated the connectString dbName dbServer dbtype provider and providerDSN attributes They do not work and might cause an...

Страница 207: ...CorLevel CorDesc FROM CourseList ORDER by Dept_ID ASC CorNumber ASC cfquery h3 cfgrid Example h3 I Try adding a course to the database and then deleting it i cfform cfgrid name FirstGrid width 450 qu...

Страница 208: ...name Content Disposition uses the default file character encoding to encode this header s value so the name of a file can include characters in the character encoding used in the file Attributes Attr...

Страница 209: ...nerates custom HTTP response headers to return to the client p This example forces browser client to purge its cache of requested file cfheader name Expires value GetHttpTimeString Now statusCode Requ...

Страница 210: ...xml_resource_feed html for more information on this feed Set the URL address cfset urlAddress http www macromedia com devnet resources macromedia_resources rdf Use the CFHTTP tag to get the file cont...

Страница 211: ...d 211 strong Description strong item description xmlText br strong Applies to these products strong br cfloop index i from 1 to arrayLen item subject step 1 item subject i xmltext br cfloop br cfoutpu...

Страница 212: ...tipart yes or no path path file filename name queryname columns query_columns firstrowasheaders yes or no delimiter character textQualifier character result result_name cfhttpparam tags optional for s...

Страница 213: ...ibutes control the HTTP transaction and can be used for all HTTP methods Attribute Req Opt Default Description url Req Uses the http protocol Address of the resource on the server which will handle th...

Страница 214: ...nformation about the communication options available for the server or the specified URL This method enables the ColdFusion application to determine the options and requirements associated with a URL...

Страница 215: ...se body do not work yes resolves URLs in the response body to absolute URLs including the port number so that links in a retrieved page remain functional Applies to these HTML tags img src a href form...

Страница 216: ...and the timeout attribute value this ensures that the request times out before or at the same time as the page If the URL does not specify a timeout ColdFusion uses the lesser of the Administrator tim...

Страница 217: ...as multipart form data with a Content Type of multipart form data By default ColdFusion sends cfhttp requests that contain only formField data with a Content Type of application x www form urlencoded...

Страница 218: ...lace the column names retrieved by the request with your own names If a duplicate column heading is encountered in either this attribute or in the column names from the response ColdFusion appends an...

Страница 219: ...h data and return results including CGI executables or even other ColdFusion pages Using the PUT method to upload files to a server that does not accept FTP requests This tag can and for PUT and POST...

Страница 220: ...TP server fails contains details about the failure For instance Unknown host my co com otherwise the empty string Macromedia recommends that you check this variable for an error condition before check...

Страница 221: ...n MX Administrator timeout and the URL timeout to take effect you must enable the timeout in the ColdFusion MX Administrator Server Settings page For more information see Configuring and Administering...

Страница 222: ...xmlroot xmlChildren cfset numresources ArrayLen resources cfloop index i from 1 to numresources cfset item resources i cfoutput strong a href item url xmltext item title xmltext strong a br strong Aut...

Страница 223: ...m type transaction type name data name value data value file filename encoded yes or no mimeType MIME type designator See also cfhttp GetHttpRequestData cfftp cfldap cfmail cfmailparam cfpop History C...

Страница 224: ...URL encodes the Form field by default cookie specifies a cookie to send as an HTTP header ColdFusion URL encodes the cookie name Required Optional and ignored for Body and XML types Variable name for...

Страница 225: ...oldFusion page the Form scope of the receiving page contains an entry with the name you specified in the cfhttpparam tag name attribute as the key The value of this variable is the path to a temporary...

Страница 226: ...ed to page cfoutput cfhttp fileContent cfoutput This is the cfhttpparamexample cfm page that receives and processes the Post request Its response body is the generated HTML output h3 Output the passed...

Страница 227: ...tag When testing the return value of a function that returns a Boolean you do not have to define the True condition explicitly This example uses the IsArray function cfif IsArray myarray If successfu...

Страница 228: ...ther centers are listed in italics cfoutput query getCenters cfif Trim City is San Diego OR Trim City is Santa Ana h4 Featured Center in cfif Trim City is San Diego San Diego cfelse Santa Ana cfif h4...

Страница 229: ...tag is obsolete Use the newer security tools see Conversion functions on page 453 and Chapter 16 Securing Applications in ColdFusion MX Developer s Guide History ColdFusion MX This tag is obsolete It...

Страница 230: ...tart with the current page location or a directory specified in the Administrator ColdFusion mappings page A directory in which custom ColdFusion tags are stored In this case all the cfm pages in this...

Страница 231: ...tag from a JAR file use the following syntax cfoutput mytags helloTag message mymessage cfoutput The cfimport tag must be on the page that uses the imported tags For example if you use a cfimport tag...

Страница 232: ...te URL or file system path for the file to include You can only use paths relative to the directory of the including page or a directory that is registered in the ColdFusion MX Administrator Mappings...

Страница 233: ...e Example This example shows the use of cfinclude to paste CFML or HTML code into another page dynamically h4 This example includes the dochome htm page from the CFDOCS directory The images do not dis...

Страница 234: ...ative Verity indexing tool such as Vspider or MKVDK These options however limit you to indexing a collection of files in a directory path For more information on creating indexing and searching a Veri...

Страница 235: ...as specified by the key attribute purge deletes all of the documents in a collection Causes the collection to be taken offline preventing searches refresh deletes all of the documents in a collection...

Страница 236: ...index categoryTree Optional A string value that specifies a hierarchical category or category tree for searching It is a series of categories separated by forward slashes You can specify only one cate...

Страница 237: ...e The key attribute is the name of a column in the query that contains a full filename including path Path The key attribute is the name of a column in the query that contains a directory pathname The...

Страница 238: ...itle br context mySearch context br url mySearch url br cfoutput cfdump var info EXAMPLE 2 Index a path type path cfindex collection CodeColl action refresh type path key C inetpub wwwroot vw_files ne...

Страница 239: ...docexamples SELECT FROM COURSES cfquery Update the collection with the above query results key is Course_ID in the Courses table body specifies the columns to be indexed for searching custom1 specifie...

Страница 240: ...ct_File body Emp_ID FirstName LastName Contract_File h2 Indexing Complete h2 cfsearch name mySearch collection CodeColl criteria vacation contextpassages 1 maxrows 100 cfoutput key mySearch key br tit...

Страница 241: ...eletes keys in the CodeColl collection for html files in the specified directory but not in subdirectories cfindex collection CodeColl action delete type path key C CFusionMX7 wwwroot vw_files newspap...

Страница 242: ...onError script name size integer value initial value bind bind expression checked disabled true or false or no attribute value src image URL onKeyUp JavaScript or ActionScript onKeyDown JavaScript or...

Страница 243: ...heir value matches the posted value for the control In earlier releases if the posted value did not match any of the cfinput check boxes or radio buttons for the control the checked attribute was used...

Страница 244: ...th type text Mask characters and the corresponding valid input characters are A A Za z X A Za z0 9 9 0 9 Any character All other characters insert the literal character Flash only For tags with type d...

Страница 245: ...syntax see Chapter 27 Building Dynamic Forms with cfform Tags in ColdFusion MX Developer s Guide onValidate Optional HTML and XML only Custom JavaScript function to validate user input The form objec...

Страница 246: ...aScript HTML XML or ActionScript Flash to run when the user releases a mouse button in the control onChange Optional All JavaScript HTML XML or ActionScript Flash to run when the control changes due t...

Страница 247: ...de Validation The following sections describe how to do validation in cfinput tags Validation methods ColdFusion provides four methods of validation of cfinput text and password fields You can specify...

Страница 248: ...ields in ColdFusion MX Developer s Guide validation types You can use the following values in the validate attribute to specify input validation for all validation methods Most attributes apply only t...

Страница 249: ...text field In Flash format the mask can also control the format of the date chosen using the datefield input control In text fields ColdFusion automatically inserts any literal mask characters such a...

Страница 250: ...ttribute lets you populate form fields using the contents of other form fields To specify text from another field in a cftextarea bind attribute use the following format sourceTagName text For example...

Страница 251: ...t name MyZip message Enter zip code formatted xxxxx or xxxxx xxxx validate zipcode required yes font size 1 color red Required font Range validation p Range Validation enter an integer from 1 to 5 br...

Страница 252: ...es Attribute Req Opt Default Description dataSource Required Data source contains table tableName Required Table in which to insert form fields ORACLE drivers must be uppercase Sybase driver case sens...

Страница 253: ...existing state of the database cfquery name GetComments dataSource cfdocexamples SELECT CommentID EMail FromUser Subject CommtType MessText Posted Processed FROM Comments cfquery html head head h3 cf...

Страница 254: ...form for input form action cfinsert cfm method post pre Email input type Text name email From input type Text name fromUser Subject input type Text name subject Message textarea name MessText COLS 40...

Страница 255: ...ute per parameter As a structure in the argumentCollection attribute Category Extensibility tags Syntax Syntax 1 This syntax invokes a method of a component cfinvoke component component name or refere...

Страница 256: ...component method method name returnVariable variable name argumentCollection argument collection OR Syntax 4B This syntax invokes a web service This syntax shows instantiation with the cfobject tag Th...

Страница 257: ...associative array of arguments to pass to the method username Optional Overrides username specified in Administrator Web Services password Optional Overrides password specified in Administrator Web S...

Страница 258: ...tive and corresponds to the port element s name attribute under the service element Specify this attribute if the web service contains multiple ports input_params Input parameters For each named input...

Страница 259: ...on params cfinvokeargument name a value 3 cfinvoke Note The following cfinvoke tag attribute names are reserved they cannot be used for argument names component method argumentCollection and result Ex...

Страница 260: ...emp cfoutput For more information on web services see Chapter 36 Using Web Services in ColdFusion MX Developer s Guide Example5 This example uses Syntax 4A Separate instantiation and method invocation...

Страница 261: ...example you can use conditional processing to determine the argument name or you can use a cfif tag to determine whether to execute the cfinvokeargument tag If you are invoking a web service you can...

Страница 262: ...value mot cfinvokeargument name symbol value macr cfinvoke cfoutput res cfoutput Example2 cfinvoke webservice http www xmethods net sd 2001 BabelFishService wsdl method BabelFish returnVariable varNam...

Страница 263: ...yes or no referral number_of_allowed_hops secure multi_field_security_string separator separator_character delimiter delimiter_character See also cfftp cfhttp cfmail cfmailparam cfpop Chapter 23 Mana...

Страница 264: ...equires attributes attribute modify modifies LDAP entries except distinguished name dn attribute on LDAP server Requires dn See modifyType attribute modifyDN modifies distinguished name attribute for...

Страница 265: ...sort desc descending z to a case sensitive sort You can enter a combination of sort types for example sortControl nocase asc dn Required if action Add Modify ModifyDN or delete Distinguished name for...

Страница 266: ...separator Optional comma Delimiter to separate attribute values of multi value attributes Used by query add and modify actions and by cfldap to output multi value attributes For example if dollar sig...

Страница 267: ...more public LDAP servers see a href http www emailman com http www emailman com a p p Enter a name and search the public LDAP resource An asterisk before or after the name acts as a wildcard p If for...

Страница 268: ...pter 2 ColdFusion Tags tr cfoutput table center cfif cfif form action cgi script_name method POST p Enter a name to search in the database p input type Text name name input type Submit value Search na...

Страница 269: ...This tag has no effect if you use it after the cfflush tag on a page Example h3 cflocation Example h3 p This tag redirects the browser to a web resource normally you would use this tag to go to a CF p...

Страница 270: ...is Read only Allows multiple requests to access CFML constructs within the tag body concurrently Use a read only lock only when shared data is read and not modified If another request has an exclusive...

Страница 271: ...Otherwise behavior depends on throwOnTimeout attribute value If you set timout 0 the timeout is determined by the Timeout Requests after x setting in the ColdFusion MX Administrator Settings page if...

Страница 272: ...an block request threads for long periods and radically decrease throughput To prevent this always use the minimum timeout value Another cause of blocked request threads is inconsistent nesting of cfl...

Страница 273: ...uide Article 20370 ColdFusion Locking Best Practices on the Macromedia website at www macromedia com support service Example This example shows how cflock can guarantee consistency of data updates to...

Страница 274: ...ock scope Session timeout 30 type Exclusive cfparam name session size Default form size cfparam name session color Default form color cflock Lock the code that updates the Application scope number of...

Страница 275: ...d Select a size td td select type Text name size option XXsmall option Xsmall option small option medium option large option Xlarge select td tr tr td Press Submit when you are finished making your se...

Страница 276: ...g log Optional If you omit the file attribute writes messages to standard log file Ignored if you specify file attribute Application writes to Application log normally used for application specific me...

Страница 277: ...specify no for the application attribute the corresponding entry in the list is empty You can disable cflog tag execution For more information see the ColdFusion Administrator Basic Security page The...

Страница 278: ...on MX Developer s Guide History ColdFusion MX 6 1 Changed behavior the cflogin variable exists when ColdFusion receives a request with NTLM or Digest CFHTTP Negotiated header authentication informatio...

Страница 279: ...d A request that uses NTLM or Digest authentication In this case the username and password are hashed using a one way algorithm in the Authorization header ColdFusion gets the username from the web se...

Страница 280: ...280 Chapter 2 ColdFusion Tags cfif qSecurity recordcount gt 0 cfloginuser name cflogin name password cflogin password roles trim qSecurity Roles cfif...

Страница 281: ...sion expires or the user is logged out by the cflogout tag ColdFusion MX Added this tag Attributes Usage Used inside the cflogin tag to identify the authenticated user to ColdFusion After you call thi...

Страница 282: ...See also cflogin cfloginuser Chapter 16 Securing Applications in ColdFusion MX Developer s Guide History ColdFusion MX 6 1 Changed behavior if the Session scope is enabled a login remains in effect un...

Страница 283: ...floop conditional loop on page 286 cfloop looping over a date or time range on page 287 cfloop looping over a query on page 288 cfloop looping over a list or file on page 290 cfloop looping over a COM...

Страница 284: ...1 2 1 9 but not 2 This is a programming language problem regarding the internal representation of floating point numbers Note The to value is evaluated once when the cfloop tag is encountered Any cha...

Страница 285: ...1 cfloop The output of this loop is as follows The loop index is 1 The loop index is 2 The loop index is 3 The loop index is 4 As before the value of j is decremented by one for each iteration but th...

Страница 286: ...execute cfexit cfif cflocation cfswitch cfthrow cftry cfloop and cfbreak in Chapter 2 Elements of CFML in ColdFusion MX Developer s Guide Attributes Example The following example increments CountVar f...

Страница 287: ...ys stepping by 7 days at a time and displaying the date cfset startDate Now cfset endDate Now 30 cfloop from startDate to endDate index i step CreateTimeSpan 7 0 0 0 cfoutput dateformat i mm dd yyyy b...

Страница 288: ...e MessageRecords dataSource cfdocexamples SELECT FROM Messages cfquery cfloop query MessageRecords cfoutput Message_ID cfoutput br cfloop The cfloop tag also iterates over a record set with dynamic st...

Страница 289: ...he pages that are returned by a query of a list of page names into one document using the cfinclude tag cfquery name GetTemplate dataSource Library maxRows 5 SELECT TemplateName FROM Templates cfquery...

Страница 290: ...ist John Paul George Ringo cfoutput ListElement cfoutput br cfloop You can put more than one character in the delimiters attribute in any order For example this loop processes commas colons and slashe...

Страница 291: ...cfloop looping over a list or file 291 To loop over each line of a file use the tag this way cfloop list theFile index curLine delimiters chr 10 chr 13 cfloop...

Страница 292: ...n the cfoutput section the name property of the file2 item is referenced for display For more information see Chapter 38 Integrating COM and CORBA Objects in CFML Applications in ColdFusion MX Develop...

Страница 293: ...cfloop looping over a COM collection or structure 293 tr td person td td StructFind Departments person td tr cfloop table cfoutput...

Страница 294: ...ery_row maxrows max_msgs server serverspecs port port_id mailerid headerid timeout seconds spoolenable yes or no debug yes or no Optional Mail message body and or cfhttpparam tags cfmail See also cfma...

Страница 295: ...enerated For example to send messages that give customers status updates Status of Order Number Order_ID replyto Optional Address es to which the recipient is directed to send replies failto Optional...

Страница 296: ...al Path of file to attach to message Attached file is MIME encoded ColdFusion attempts to determine the MIME type of the file use the cfmailparam tag to send an attachment and specify the MIME type qu...

Страница 297: ...mailer application timeout Optional Number of seconds to wait before timing out connection to SMTP server A value here overrides the Administrator spoolEnable Optional Specifies whether to spool mail...

Страница 298: ...nal servers For each server you can optionally specify a username password and port These values override the corresponding attributes if any The server attribute has the following format user passwor...

Страница 299: ...ype Text name MailFrom SUBJECT input type Text name Subject hr MESSAGE BODY textarea name body cols 40 rows 5 wrap virtual textarea pre Establish required fields input type hidden name MailTo_required...

Страница 300: ...mailpart cfftp cfhttp cfldap cfpop Using the cfmailparam tag in Chapter 39 Sending and Receiving E Mail in ColdFusion MX Developer s Guide History ColdFusion MX 6 x Added the Disposition and ContentID...

Страница 301: ...bject See Important Attachments and Reply cfmailparam name Importance value High Please review the new logo Tell us what you think cfmailparam file c work readme txt type text plain cfmailparam file c...

Страница 302: ...age in the body of an HTML message p cfmail type HTML to form mailto from form mailFrom subject Sample inline image cfmailparam file C Inetpub wwwroot web gif disposition inline contentID image1 P The...

Страница 303: ...art cfmail History ColdFusion MX 6 1 Added this tag See also cfmail cfmailparam cfpop cfftp cfhttp cfldap cfcontent Wrap E mail in Chapter 17 Developing Globalized Applications in ColdFusion MX Develo...

Страница 304: ...Mail Message h3 p You are reading this message as strong HTML strong p p Your mail reader handles HTML text p cfmailpart cfmail wraptext Optional Do not wrap text Specifies the maximum line length in...

Страница 305: ...ue that is within the attributeCollection parameter Earlier releases did not process this consistently Attributes Attribute Req Opt Default Description template Required unless name attribute is used...

Страница 306: ...nd tag to cfmodule ColdFusion calls your custom tag as if it had both a start and an end tag For more information see Handling end tags of Chapter 11 Creating and Using Custom CFML Tags in ColdFusion...

Страница 307: ...2 color 0000A0 P Here is another way to invoke the custom tag using the NAME attribute P cfoutput HTMLCodeFormat CFMODULE NAME myTag X 3 attributeCollection attrCollection1 Y 4 cfoutput P The result...

Страница 308: ...nothing on UNIX and Linux systems You typically use this tag inside a cflogin tag to authenticate the user for a cfloginuser tag as shown in the example Attribute Req Opt Default Description name Requ...

Страница 309: ...ticated and contains a logout link A login form page that is displayed if the user is not logged in The Application cfm page which contains all the login authentication and logout processing code For...

Страница 310: ...s are available cfif NOT IsDefined cflogin Show a login form that posts back to the page whose request initiated the login and do not process the rest of this page cfinclude template loginform cfm cfa...

Страница 311: ...cfNTauthenticate 311 Please Try again H2 cfif cfoutput cfinclude template loginform cfm cfabort cfif cfif cflogin...

Страница 312: ...cfargument cfcomponent cffunction cfinvoke cfinvokeargument cfproperty cfreturn Using Java objects in Chapter 37 Integrating J2EE and Java Elements in CFML Applications in ColdFusion MX Developer s Gu...

Страница 313: ...pport COM objects Syntax cfobject type com action action class program_ID name text context context server server_name See also ReleaseComObject cfcollection cfexecute COM in Chapter 17 Developing Glo...

Страница 314: ...ms br HR cfoutput Get the 3rd object in the collection cfset emp obj Item 3 cfoutput The last name in the third item is emp lastname br HR cfoutput Loop over all the objects in the collection p Loopin...

Страница 315: ...rches first for a file with a name that matches the specified component name but is all lowercase If it does not find the file it looks for a filename that matches the component name exactly with the...

Страница 316: ...nameservice ColdFusion uses naming service to access server This option is valid only with the InitialContext of a VisiBroker Orb class Required If context ior absolute path of file that contains stri...

Страница 317: ...h CORBA objects you must provide the name of the file that contains a string formatted version of the IOR or the object s naming context in the naming service and the object s attributes method names...

Страница 318: ...Fusion using the cfobject tag To access Java methods and fields do the following steps 1 Call the cfobject tag to load the class See the example code 2 Use the init method with appropriate arguments t...

Страница 319: ...ion create type java class myclass name myobj Example of an EJB The cfobject tag creates the Weblogic Environment object which is used to get InitialContext The context object is used to look up the E...

Страница 320: ...s Guide Attributes Usage Instantiates a proxy object for a web service You can enter the absolute URL in this tag or refer to a web service that is entered in the ColdFusion Administrator To minimize...

Страница 321: ...ry cache Category Database manipulation tags Syntax cfobjectcache action clear See also cfobject History ColdFusion 5 Added this tag Attributes Attribute Req Opt Default Description action Required cl...

Страница 322: ...oldFusion variable or function call For example the following code displays the text Hello World cfset myVar Hello World cfoutput myVar cfoutput Attribute Req Opt Default Description query Optional Na...

Страница 323: ...le to show today s date you could write DateFormat Now If you enclosed that expression in cfoutput the result would be cfoutput DateFormat Now cfoutput p In addition cfoutput may be used to show the r...

Страница 324: ...t_id d dept_id ORDER BY d dept_name cfquery Outer cfoutput cfoutput query empSalary group dept_id h2 dept_name h2 table width 95 border 2 cellspacing 2 cellpadding 2 tr th Employee th th Salary th tr...

Страница 325: ...lue max value min value pattern regular expression See also cfcookie cfregistry cfsavecontent cfschedule cfset Validating data with the IsValid function and the cfparam tag in Chapter 28 Validating Da...

Страница 326: ...XXXXXXXXXXXX where X is a hexadecimal number integer an integer query a query object range a numeric range specified by the min and max attributes regex or regular_expression matches input against pat...

Страница 327: ...ot check whether the parameter value corresponds to an existing ColdFusion variable Tip To improve performance avoid using the cfparam tag in ColdFusion functions including in CFC methods Instead plac...

Страница 328: ...and tempVar is not h3 The value of tempVar has changed the new value is cfoutput tempVar cfoutput h3 cfif p form action cfparam cfm method post Type in a new value for tempVar and hit submit br input...

Страница 329: ...usion MX 6 1 Added support for multipart mail messages with Text and HTML parts Changed the attachment name separator the TAB character is now the separator between attachment names in the attachments...

Страница 330: ...mma delimited list of UIDs to get or delete Invalid UIDs are ignored attachment Path Optional If action getAll specifies a directory in which to save any attachments If the directory does not exist Co...

Страница 331: ...ptional No Yes generate unique filenames for files attached to an e mail message to avoid naming conflicts when files are saved No debug Optional No Yes sends debugging output to standard output By de...

Страница 332: ...te these temporary files when you have processed them To create a ColdFusion date time object from the date time string that is extracted from a mail message in the queryname date column use the follo...

Страница 333: ...IsDefined form server Make sure server username are not empty cfif form server is not and form username is not cfpop server form popserver username form username password form pwd action getHeaderOnly...

Страница 334: ...fprocessingdirective pageencoding page encoding literal string or cfprocessingdirective suppressWhiteSpace yes or no pageEncoding page encoding literal string CFML tags cfprocessingdirective See also...

Страница 335: ...o on the tag has no effect on the included pages Attribute Req Opt Default Description suppressWhiteSpace Optional Boolean whether to suppress white space characters within the cfprocessingdirective b...

Страница 336: ...OM ColdFusion generates an error The following rules apply to the suppressWhiteSpace attribute You can specify the suppresswhitespace attribute value as a constant or a variable To use a variable defi...

Страница 337: ...ow ignored for all drivers ColdFusion MX uses JDBC 2 2 and does not support named parameters Changed the maxLength attribute behavior it now applies to IN and INOUT parameter values Attributes Attribu...

Страница 338: ...rted parameter types CF_SQL_BIGINT CF_SQL_BIT CF_SQL_BLOB CF_SQL_CHAR CF_SQL_CLOB CF_SQL_DATE CF_SQL_DECIMAL CF_SQL_DOUBLE CF_SQL_FLOAT CF_SQL_IDSTAMP CF_SQL_INTEGER CF_SQL_LONGVARCHAR CF_SQL_MONEY CF...

Страница 339: ...created compiled and bound in the RDBMS environment CREATE OR REPLACE PACKAGE Foo_Data AS TYPE EmpTyp IS REF CURSOR RETURN Emp ROWTYPE TYPE DeptTyp IS REF CURSOR RETURN Dept ROWTYPE PROCEDURE refcurp...

Страница 340: ...lt set b br hr cftable query rs1 colHeaders HTMLTable border 1 cfcol header EMPNO text EMPNO cfcol header EMPLOYEE name text ENAME cfcol header JOB text JOB cfcol header SALARY text SAL cfcol header D...

Страница 341: ...the scope of the cfstoredproc tag If you specify a result set twice the second occurrence overwrites the first CFML supports Oracle 8 and 9 Reference Cursor type which passes a parameter by reference...

Страница 342: ...ype OUT CFSQLType CF_SQL_DATE variable FOO dbVarName param2 Close the cfstoredproc tag cfstoredproc cfoutput The output param value foo br cfoutput h3 The Results Information h3 cfoutput query RS1 nam...

Страница 343: ...t to inheritance rules Category Extensibility tags Syntax cfproperty name name type type required boolean default default value displayname descriptive name hint extended description See also cfargume...

Страница 344: ...UUID of the form xxxxxxxx xxxx xxxx xxxxxxxxxxxxxxxx where each x is a character representing a hexadecimal number 0 9A F variableName a string formatted according to ColdFusion variable naming conve...

Страница 345: ...property name Number type numeric cfproperty name Street type string cfproperty name City type string cfproperty name State type string cfproperty name Country type string cfcomponent This component r...

Страница 346: ...name username password password maxRows number blockFactor blocksize timeout seconds cachedAfter date cachedWithin timespan Either of the following debug yes or no or debug result result_name cfquery...

Страница 347: ...specify either dbtype or dataSource dbtype Optional Use this value to specify the results of a query as input You must specify either dbtype or dataSource username Optional Overrides username in data...

Страница 348: ...uery data is used CreateTimeSpan defines a period from the present back Takes effect only if query caching is enabled in the Administrator To use cached data the current query must use the same SQL st...

Страница 349: ...e escaped The escape character is the bracket for example SELECT count FROM MYTABLE For a list of reserved keywords in ColdFusion MX see Escaping reserved keywords in Chapter 22 Using Query of Queries...

Страница 350: ...ntRow b td td valign top font size 1 ParkName font td td valign top font size 1 Region font td td valign top font size 1 State font td tr cfoutput If the total number of records is less than or equal...

Страница 351: ...curity Bulletin ASB99 04 Multiple SQL Statements in Dynamic Queries at www macromedia com devnet security security_zone asb99 04 html and Chapter 20 Accessing and Retrieving Data in ColdFusion MX Deve...

Страница 352: ...CF_SQL_LONGVARCHAR CF_SQL_MONEY CF_SQL_MONEY4 CF_SQL_NUMERIC CF_SQL_REAL CF_SQL_REFCURSOR CF_SQL_SMALLINT CF_SQL_TIME CF_SQL_TIMESTAMP CF_SQL_TINYINT CF_SQL_VARCHAR maxLength Optional Length of string...

Страница 353: ...or these types a data value can be converted to a numeric value CF_SQL_SMALLINT CF_SQL_INTEGER CF_SQL_REAL CF_SQL_FLOAT CF_SQL_DOUBLE CF_SQL_TINYINT CF_SQL_MONEY CF_SQL_MONEY4 CF_SQL_DECIMAL CF_SQL_NU...

Страница 354: ...nchar char nchar char nchar unique identifier CF_SQL_INTEGER INTEGER Integer integer serial int CF_SQL_LONGVARBINARY LONGVARBINARY Long Varchar for Bit Data byte long raw image CF_SQL_LONGVARCHAR LON...

Страница 355: ...attribute p cfset LastName Peterson DELETE employees WHERE LastName Peterson Note that for string input you must specify the MAXLENGTH attribute for validation cfquery name getFirst datasource cfdocex...

Страница 356: ...tion attribute value See the following sections cfregistry action getAll on page 357 cfregistry action get on page 359 cfregistry action set on page 360 cfregistry action delete on page 361 See also c...

Страница 357: ...nary registry values For binary values the type variable contains UNSUPPORTED and value is blank Example This example uses cfregistry with the getAll action cfregistry action getAll branch HKEY_LOCAL_...

Страница 358: ...istry action getAll h1 cftable query RegQuery colHeaders HTMLTable border Yes cfcol header b Entry b width 35 text RegQuery Entry cfcol header b Type b width 10 text RegQuery type cfcol header b Value...

Страница 359: ...te an entry Example This example uses cfregistry with the get action cfregistry action get branch HKEY_LOCAL_MACHINE Software Microsoft Java VM entry ClassPath type String variable RegValue h1 cfregis...

Страница 360: ...y value data Normally you pass in a filename instead of setting one here cfset FileName dummy cfm cfregistry action set branch HKEY_LOCAL_MACHINE Software cflangref entry LastCFM01 type String value F...

Страница 361: ...tes values and subkeys defined beneath it Example cfregistry action delete branch HKEY_LOCAL_MACHINE Software cflangref tempkey entry LastCFM01 h1 cfregistry action delete h1 Attribute Req Opt Default...

Страница 362: ...report template report definition filename format PDF or FlashPaper or excel name cf variable filename output filename query query variable overwrite yes or no encryption 128 bit or 40 bit or none own...

Страница 363: ...port Builder Opt The name of the ColdFusion variable that will hold the report output You cannot specify both name and filename filename Report Builder Opt The filename to contain the report You canno...

Страница 364: ...Maximum time in seconds in which a connection must be made to a Crystal Reports file report Crystal Reports Requir ed Report path Store Crystal Reports files in the same directories as ColdFusion page...

Страница 365: ...me FirstName Title City Region Country FROM Employees ORDER BY Country City cfquery CFREPORT format PDF template FifthReport cfr query northwindemployees Example 2 This view only example shows the use...

Страница 366: ...ust include an input parameter that matches the name attribute You can use cfreportparam to pass data to a report definition as an alternative to the cfreport query attribute Example cfquery name cour...

Страница 367: ...cfreportparam 367 cfreport format PDF template FourthReport cfr query coursedept overwrite yes cfreportparam NAME ReportTime VALUE DateFormat Now TimeFormat Now cfreport...

Страница 368: ...ception and the code is designed to handle only CFX exceptions the handler raises the exceptions again with details intact so that a higher level handler can process the error information If you used...

Страница 369: ...equivalent to a return statement within a cfscript tag It accepts one return variable argument To return more than one value populate a structure with name value pairs and return the structure with th...

Страница 370: ...370 Chapter 2 ColdFusion Tags cffunction cffunction name getDept cfquery name deptQuery datasource ExampleApps SELECT FROM tblDepartments cfquery cfreturn deptQuery cffunction cfcomponent...

Страница 371: ...ion MX Developer s Guide Attributes Usage This tag requires an end tag You cannot use this tag to suppress output from a tag library Example The following example uses a custom tag to generate a repor...

Страница 372: ...populate the page Category Variable manipulation tags Syntax cfschedule action update task taskname operation HTTPRequest file filename path path_to_file startDate date startTime time url URL port por...

Страница 373: ...d if publish Yes Path to the directory in which to put the published file startDate Required if action update Date on which to first run the scheduled task startTime Required if action update Time at...

Страница 374: ...he 29th or 30th of the month the job will run on the specified day of each month for 30 or 31 day months and the last day of February For example if you schedule a monthly job to start on January 30 t...

Страница 375: ...375 operation HTTPRequest url http 127 0 0 1 playpen history cfm startDate 8 7 03 startTime 12 25 PM interval 3600 resolveURL Yes publish Yes file sample html path c inetpub wwwroot playpen requestTi...

Страница 376: ...This tag uses ColdFusion functions expressions and operators You can read and write ColdFusion variables within this tag For a detailed description of the CFScript scripting language including documen...

Страница 377: ...nction The following example shows how to invoke a component object with the cfscript tag using ordered arguments cfscript quote CreateObject component nasdaq quote Invocation using ordered arguments...

Страница 378: ...01 BabelFishService wsdl xlatstring ws BabelFish en_es Hello world friend writeoutput xlatstring cfscript For more information see Chapter 36 Using Web Services in ColdFusion MX Developer s Guide Exam...

Страница 379: ...cfcollection tag In the ColdFusion MX Administrator A collection can be indexed in the following ways In ColdFusion with the cfindex tag In the ColdFusion MX Administrator which calls the cfindex tag...

Страница 380: ...t each collection it automatically detects whether a collection is internal or external This tag supports absolute also known as fully qualified collection pathnames and mapped collection names Change...

Страница 381: ...riteria simple STEM and MANY operators are implicitly used explicit operators must be invoked explicitly Also known as Bool_Plus internet for documents that are mostly WYSIWIG what you see is what you...

Страница 382: ...sages sentences Verity returns in the context summary that is the context column of the results The default i s 0 which disables context summary contextBytes Optional 300 The maximum number of bytes V...

Страница 383: ...tag used to populate the collection including PDF and Office document titles If a title is not extracted from the document the tag uses the cfindex title attribute value for each row score Relevancy...

Страница 384: ...ee Chapter 25 Using Verity Search Expressions in ColdFusion MX Developer s Guide Example 1 TYPE SIMPLE cfsearch name name collection snippets syntax snippets criteria example maxrows 100 p cfoutput Se...

Страница 385: ...it startrow 1 maxrows 100 cfoutput query snippets url url br key key br title title br score score br custom1 custom1 br custom2 custom2 br summary summary br recordcount recordcount br currentrow cur...

Страница 386: ...386 Chapter 2 ColdFusion Tags currentrow book currentrow br columnlist book columnlist br recordssearched book recordssearched br cfoutput cfdump var book...

Страница 387: ...r ActionScript onMouseUp JavaScript or ActionScript onMouseDown JavaScript or ActionScript onChange JavaScript or ActionScript onClick JavaScript or ActionScript visible Yes or No enabled Yes or No to...

Страница 388: ...ame syntax and contents as used in Macromedia Flex for the corresponding Flash element size Optional All 1 Number of entries to display at one time The default 1 displays a drop down list Any other va...

Страница 389: ...aScript HTML XML or ActionScript Flash to run when the user releases a keyboard key in the control onKeyDown Optional All JavaScript HTML XML or ActionScript Flash ActionScript to run when the user pr...

Страница 390: ...option generates an HTML optgroup tag for each entry in the group column Close each HTML option tag in the cfselect tag body with a option end tag If you do not do so and you specify queryPosition be...

Страница 391: ...ame as Name FROM GetAllEmployees WHERE Emp_ID in form employeeid cfquery Display the names and e mail addresses from the query cfoutput query GetSelectedEmployees firstName lastName br Email email br...

Страница 392: ...server as ColdFusion use code such as the following in which path specifies a servlet JSP or anything else GetPageContext include path GetPageContext forward path For more information see the JSP Pag...

Страница 393: ...to the servlet To access servlets that run on the same server as ColdFUsion use code such as the following in which path specifies a servlet JSP or anything else GetPageContext include path GetPageCon...

Страница 394: ...s not return a value or you do not need to use the value returned by the function For example the following line is a valid ColdFusion cfset tag for deleting the MyVariable variable from the Applicati...

Страница 395: ...the beginning of the cffunction tag body before any other ColdFusion tags The following example shows how to use the new keyword cffunction name myFunct cfset var myVar This is a test cfreturn myVar...

Страница 396: ...t URLEncodedFormat hey you get off of my cloud cfoutput click here A to display a message p cfif IsDefined url test is True cfoutput b I url test i b cfoutput cfelse h3 The variable url test has not b...

Страница 397: ...ribute is obsolete It does not work and causes an error in releases later than ColdFusion 5 Changed exception handling the structured exception manager searches for the best fit cfcatch handler In ear...

Страница 398: ...utOnly No statements have been processed the first enableCFoutputOnly Yes statement blocks output If the debugging service is enabled and showDebugOutput Yes the IsDebugMode function returns Yes other...

Страница 399: ...r cfhtmlhead cfinclude cfsetting Chapter 9 Writing and Calling User Defined Functions in ColdFusion MX Developer s Guide Usage This tag requires an end tag Example h3 cfsilent h3 cfsilent cfset a 100...

Страница 400: ...r vSpace integer hSpace integer align alignment lookAndFeel motif or windows or metal vertical yes or no bgColor color textColor color font font_name fontSize integer italic yes or no bold yes or no n...

Страница 401: ...idate Optional Custom JavaScript function to validate user input in this case a change to the default slider value Specify only the function name message Optional Message text to appear if validation...

Страница 402: ...er label For a hexadecimal value use the form bgColor xxxxxx where x 0 9 or A F use two number signs or none Any color in hexadecimal format black red blue magenta cyan orange darkgray pink gray white...

Страница 403: ...how to use cfslider within cfform h3 cfslider Example h3 p cfslider used within a cfform can provide functionality to Java enabled browsers p Try moving the slider back and forth to see the real time...

Страница 404: ...Fusion MX Developer s Guide History ColdFusion MX 7 Added the result attribute ColdFusion MX Deprecated the connectString dbName dbServer dbtype provider and providerDSN attributes They do not work an...

Страница 405: ...e same time to avoid overwriting the results of one call with another If you set the result attribute to myResult for example you would access ExecutionTime as myResult ExecutionTime Otherwise you wou...

Страница 406: ...The output param value foo br cfoutput h3 The Results Information h3 cfoutput query RS1 name DATE_COL br cfoutput p cfoutput hr p Record Count RS1 recordCount p Columns RS1 columnList hr cfoutput cfou...

Страница 407: ...an put the cfdefaultcase tag at any position within a cfswitch statement it is not required to be the last item Attributes Usage This tag requires an end tag All code within this tag must be within a...

Страница 408: ...a cfloop construct p Each time the case is fulfilled the specific information is printed if the case is not fulfilled the default case is output p cfoutput query GetEmployees cfswitch expression Trim...

Страница 409: ...of_lines HTMLTable border colHeaders startRow row_number cftable See also cfcol cfcontent cflog cfoutput cfprocessingdirective cftable Retrieving data in Chapter 20 Accessing and Retrieving Data in Co...

Страница 410: ...SELECT Emp_ID FirstName LastName EMail Phone Department FROM Employees cfquery html body h3 cftable Example h3 Note use of HTMLTable attribute to display cftable as an HTML table rather than as PRE fo...

Страница 411: ...cftable 411 cftable body html...

Страница 412: ...ActionScript onMouseUp JavaScript or ActionScript onMouseDown JavaScript or ActionScript onChange JavaScript or ActionScript onClick JavaScript or ActionScript visible Yes or No enabled Yes or No tool...

Страница 413: ...the format For details see the Usage section of the cfinput tag reference validateAt Optional HTML and XML onSubmit How to do the validation one or more of the following onSubmit onServer onBlur For...

Страница 414: ...ue to display in text control You can specify an initial value as an attribute or in the tag body but not in both places If you specify the value as an attribute you must put the closing cftextarea ta...

Страница 415: ...uide Flash form data binding The bind attribute lets you populate form fields using the contents of other form fields To specify text from another field in a cftextarea bind attribute use the followin...

Страница 416: ...re on a single line to ensure that only the desired text displays but the line is split in this example for formatting purposes h3 cftextarea Example h3 cfparam name text2 default cfif isdefined form...

Страница 417: ...ed in XML format forms In its place you should use a cfinput or cftextarea tag and use a cascading style sheet CSS to specify the text style characteristics History ColdFusion MX 7 This tag is depreca...

Страница 418: ...try onError Chapter 14 Handling Errors in ColdFusion MX Developer s Guide History ColdFusion MX Changed thrown exceptions this tag can throw ColdFusion component method exceptions Attributes Attribute...

Страница 419: ...name obj If your exception class has constructors that take parameters such as a message you can use the special init method to invoke the constructor as in the following line If you do not need to sp...

Страница 420: ...t cfcatch cftry Example2 The following example shows how to throw an exception from a component method cfcomponent cffunction name getEmp cfargument name lastName required yes cfquery name empQuery da...

Страница 421: ...long it takes for a block of code to execute You can nest cftimer tags This tag is useful for debugging CFML code during application development In production you can leave cftimer tags in your code a...

Страница 422: ...lect from CourseList cfquery table border 1 width 100 cfoutput query coursequery tr td Course_ID td td CorName td td CorLevel td tr cfoutput table cftimer hr br type comment cftimer label Query and CF...

Страница 423: ...r 423 from Departments cfquery p Scroll down to CFTimer Times heading to see timing information p table border 1 width 100 cfoutput query deptquery tr td Dept_ID td td Dept_Name td tr cfoutput table c...

Страница 424: ...Trace section Category Debugging tags Variable manipulation tags Syntax cftrace abort Yes or No category string inline Yes or No text string type format var variable_name cftrace See also cfdump cferr...

Страница 425: ...8 5187 ms 10 C CFusionMX7 wwwroot generic cfm line 14 category thisPage generic cfm ABORTED thisPage For a complex variable ColdFusion lists the variable name and the number of elements in the object...

Страница 426: ...Attributes Attribute Req Opt Default Description action Optional begin begin the start of the block of code to execute commit commits a pending transaction rollback rolls back a pending transaction is...

Страница 427: ...the cftransaction action rollback tag within the block In these examples the slash is alternate syntax that is the equivalent of an end tag Within a transaction block you can write queries to more tha...

Страница 428: ...s or metal 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 style...

Страница 429: ...ribute For details of the structure contents see object format xml generates an XML representation of the tree In XML format forms includes the generated XML in the form In HTML format forms puts the...

Страница 430: ...et object windows motif renders the slider in Motif style windows renders the slider in Windows style metal renders the slider in Java Swing style If the platform does not support a style option the t...

Страница 431: ...ifying whether to show the control Space that would be occupied by an invisible control is blank tooltip Optional Flash Flash format only Text to display when the mouse pointer hovers over the control...

Страница 432: ...pulates 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 th...

Страница 433: ...th highlightHref lookAndFeel appendKey delimiter hScroll name bold fontWeight italic vscroll border Field Value children This item s child items an array of item structures display Tree item label as...

Страница 434: ...uery 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 cf...

Страница 435: ...d 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 _Conta...

Страница 436: ...The supplied XSLT skins do not handle or display XML format trees but do display applet and Flash format trees Attribute Req Opt Format Default Description value Required All Value passed when cfform...

Страница 437: ...r the img attribute href Optional All URL to link to if the user clicks the tree item If you use a query attribute the href attribute can specify a query column that contains URLs If href is not a que...

Страница 438: ...name ColdFusion links back to the same page and displays the selected employee s ID Query the datasource to get employee information Group the output by Department All fields are required in Group By...

Страница 439: ...ees 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 child...

Страница 440: ...re equivalent to the cftry and cfcatch tags Usage Within a cftry block put the code that might throw an exception followed by one ore more cfcatch tags that catch and process exceptions This tag requi...

Страница 441: ...cftry 441 cfset sCurrent CFCATCH TAGCONTEXT i br i sCurrent ID sCurrent LINE sCurrent COLUMN sCurrent TEMPLATE cfloop cfoutput cfcatch cftry...

Страница 442: ...providerDSN attributes They do not work and might cause an error in releases later than ColdFusion 5 Attributes Attribute Req Opt Default Description dataSource Required Name of the data source that c...

Страница 443: ...emp_id url id cfquery This code displays the row to edit for update cfoutput query phoneQuery form action cfupdate cfm method post phoneQuery firstName phoneQuery lastName input name phone type text...

Страница 444: ...es or no validate yes or no See also cfcollection cfdump cfexecute cfindex cfobject cfreport cfsearch ToScript Chapter 35 Using XML and WDDX in ColdFusion MX Developer s Guide History ColdFusion MX Ch...

Страница 445: ...y Create a simple query cfquery name q dataSource cfdocexamples select Message_Id Thread_id Username from messages cfquery The recordset data is p cfoutput query q topLevelVariable Required if action...

Страница 446: ...action cfml2wddx input q output wddxText Display WDDX XML packet Resulting WDDX packet is xmp cfoutput wddxText cfoutput xmp Deserialize to a variable named wddxResult Deserializing WDDX packet p cfwd...

Страница 447: ...f your XML object is case sensitive you cannot use dot notation to reference an element or attribute name Use the name in associative array bracket notation or a reference that does not use the case s...

Страница 448: ...var cfoutput mynewvar cfoutput cfprocessingdirective The cfprocessingdirective tag prevents ColdFusion from putting white space characters in front of the XML declaration Example This following exampl...

Страница 449: ...ions and manipulate data The following table lists CFML functions Abs GetFunctionList Max ACos GetGatewayHelper Mid AddSOAPRequestHeader GetHttpRequestData Min AddSOAPResponseHeader GetHttpTimeString...

Страница 450: ...List BitMaskRead Int ReplaceNoCase BitMaskSet IsArray REReplace BitNot IsBinary REReplaceNoCase BitOr IsBoolean Reverse BitSHLN IsCustomFunction Right BitSHRN IsDate RJustify BitXor IsDebugMode Round...

Страница 451: ...stFindNoCase StructUpdate DecimalFormat ListFirst Tan DecrementValue ListGetAt TimeFormat Decrypt ListInsertAt ToBase64 DeleteClientVariable ListLast ToBinary DirectoryExists ListLen ToScript DollarFo...

Страница 452: ...454 Mathematical functions 455 Other functions 455 Query functions 455 String functions 455 Structure functions 456 System functions 456 XML functions 457 Array functions GetBaseTagList LSIsNumeric X...

Страница 453: ...IsLeapYear Quarter CreateODBCTime DayOfWeekAsString IsNumericDate Second CreateTime DayOfYear LSDateFormat TimeFormat CreateTimeSpan DaysInMonth LSIsDate Week DateAdd DaysInYear LSParseDateTime Year D...

Страница 454: ...mat LSParseNumber YesNoFormat GetLocaleDisplayName LSIsCurrency LSTimeFormat DE Evaluate IIf SetVariable CreateObject ReleaseComObject ToScript GetGatewayHelper SendGatewayMessage GetK2ServerDocCount...

Страница 455: ...ims ListLen Find ListContains ListPrepend Abs BitNot FormatBaseN Randomize ACos BitOr IncrementValue RandRange ArrayAvg BitSHLN InputBaseN Round ArraySum BitSHRN Int Sgn ASin BitXor Log Sin Atn Ceilin...

Страница 456: ...aphFormat StripCR Compare LCase ParseDateTime ToBase64 CompareNoCase Left REFind ToBinary DayOfWeekAsString Len REFindNoCase ToString Decrypt LJustify RemoveChars Trim Encrypt ListValueCount RepeatStr...

Страница 457: ...OAPRequest IsXmlRoot XmlGetNodeType AddSOAPResponseHeader IsXML IsWDDX XmlNew GetSOAPRequest IsXmlAttribute ToString XmlParse GetSOAPRequestHeader IsXmlDoc XmlChildPos XmlSearch GetSOAPResponse IsXmlE...

Страница 458: ...serInRole All ColdFusion MX IsValid All ColdFusion MX 7 IsXML All ColdFusion MX 7 IsXmlAttribute All ColdFusion MX 7 IsXmlDoc All ColdFusion MX IsXmlElem All ColdFusion MX IsXmlNode All ColdFusion MX...

Страница 459: ...All ColdFusion MX XmlParse All ColdFusion MX XmlParse validator parameter ColdFusion MX 7 XmlSearch All ColdFusion MX XmlTransform All ColdFusion MX XmlTransform parameters parameter ColdFusion MX 7...

Страница 460: ...Do not use them in ColdFusion applications They do not work in releases later than ColdFusion 5 Function Parameter or value Obsolete as of this ColdFusion release AuthenticatedContext All ColdFusion...

Страница 461: ...tegory Mathematical functions Function syntax Abs number See also Sgn Parameters Example h3 Abs Example h3 p The absolute value of the following numbers 1 3 4 3 2 6 is cfoutput Abs 1 Abs 3 Abs 4 Abs 3...

Страница 462: ...mple h3 output its arccosine value cfif IsDefined FORM CosNum cfif IsNumeric FORM CosNum cfif Abs FORM CosNum LESS THAN OR EQUAL TO 1 cfoutput ACos FORM CosNum ACos FORM cosNum Radians cfoutput br or...

Страница 463: ...pace and name parameters If you require a namespace define it within the XML itself Example There are two parts to this example The first part is the web service CFC that this function as well as the...

Страница 464: ...APRequestHeader ws ignoredNameSpace ignoredName doc Invoke the web service operation ret ws echo_me argument Get the first header as an object string and as XML header getSOAPResponseHeader ws http ww...

Страница 465: ...e function It throws an error if it is invoked in a context that is not a web service request If you pass XML in the value parameter ColdFusion ignores the namespace and name parameters If you require...

Страница 466: ...e username cfset xmlusername getSOAPRequestHeader http mynamespace username TRUE cfset return return br as XML xmlusername Get the second header as a string and as XML cfset password getSOAPRequestHea...

Страница 467: ...name GetEmployeeNames datasource cfdocexamples SELECT FirstName LastName FROM Employees cfquery create an array cfset myArray ArrayNew 1 set element one to show where we are cfset myArray 1 Test Valu...

Страница 468: ...contains a comma delimited list of the names of the fields on the form Example This example shows the use of ArrayAvg The following lines of code keep track of the form fields that can be dynamically...

Страница 469: ...mber LoopItem td cfoutput tr cfloop table input type submit name submit value get the average form create an array cfif IsDefined FORM submit cfset myNumberArray ArrayNew 1 cfset Count 1 cfloop index...

Страница 470: ...sed on XML objects Parameters Example h3 ArrayClear Example h3 create a new array cfset MyArray ArrayNew 1 populate an element or two cfset MyArray 1 Test cfset MyArray 2 Other Test output the content...

Страница 471: ...Guide History ColdFusion MX Changed behavior this function can be used on XML objects Changed thrown exceptions this function can throw the InvalidArrayIndexException error Parameters Throws If this f...

Страница 472: ...y 3 1 nbsp nbsp DaysArray 3 2 br cfoutput cfoutput We delete this element of the array br ArrayDeleteAt DaysArray 2 br cfoutput the formerly third element Wednesday is second element p This is what th...

Страница 473: ...exceptions this function can throw the InvalidArrayIndexException error Parameters Usage To apply the ArrayInsert function to a multidimensional array you must specify all but the last index in the a...

Страница 474: ...DaysArray 3 Thursday add an element before position 3 p Add an element before position 3 cfoutput ArrayInsertAt DaysArray 3 Wednesday cfoutput p Now output the array as a list cfoutput ArrayToList Da...

Страница 475: ...can be used on XML objects Parameters Example h3 ArrayIsEmpty Example h3 create a new array cfset MyArray ArrayNew 1 populate an element or two cfset MyArray 1 Test cfset MyArray 2 Other Test output t...

Страница 476: ...en Example h3 cfquery name GetEmployeeNames datasource cfdocexamples SELECT FirstName LastName FROM Employees cfquery create an array cfset myArray ArrayNew 1 set element one to show where we are cfse...

Страница 477: ...in the array cfif IsDefined FORM submit cfset myNumberArray ArrayNew 1 cfset myNumberArray 1 number1 cfset myNumberArray 2 number2 cfif Form Submit is Maximum Value use ArrayMax to find the largest nu...

Страница 478: ...two elements cfif IsDefined FORM submit cfset myNumberArray ArrayNew 1 cfset myNumberArray 1 FORM number1 cfset myNumberArray 2 FORM number2 cfif Form Submit is Minimum Value use ArrayMin to find the...

Страница 479: ...s not function properly if the Array is not initialized with ArraySet cfset temp ArraySet MyNewArray 1 6 set some elements cfset MyNewArray 1 Sample Value cfset MyNewArray 3 43 cfset MyNewArray 6 Anot...

Страница 480: ...tName FROM Employees cfquery create an array cfset myArray ArrayNew 1 set element one to show where we are cfset myArray 1 Test Value loop through query Append names successively before last element l...

Страница 481: ...Array functions Function syntax ArrayResize array minimum_size Parameters Example h3 ArrayResize Example h3 perform a query to get the list cfquery name GetCourses datasource cfdocexamples SELECT FRO...

Страница 482: ...Changed behavior this function can be used on XML objects Parameters Example h3 ArraySet Example h3 Make an array cfset MyNewArray ArrayNew 1 ArrayToList does not function properly if the Array has no...

Страница 483: ...ts are returned in a textnocase descending sort this function might return elements in a different sort order than in earlier releases If sort_type textnocase and sort_order desc ColdFusion MX process...

Страница 484: ...habetically cfset isSuccessful ArraySort myArray textnocase desc sort_type numeric sorts numbers text sorts text alphabetically taking case into account also known as case sensitive All letters of one...

Страница 485: ...e first two elements in the array cfif IsDefined FORM submit cfset myNumberArray ArrayNew 1 cfset myNumberArray 1 number1 cfset myNumberArray 2 number2 cfif Form Submit is Add use ArraySum to add the...

Страница 486: ...1 position2 See also Functions for XML object management in Chapter 35 Using XML and WDDX in ColdFusion MX Developer s Guide Parameters Example h3 ArraySwap Example h3 cfset month ArrayNew 1 cfset mon...

Страница 487: ...oop query GetEmployeeNames cfset temp ArrayAppend myArray FirstName LastName cfloop show the resulting array as a list cfset myList ArrayToList myArray sort that array descending alphabetically cfset...

Страница 488: ...up to a value of 65536 Earlier releases supported 1 255 Parameters Example h3 Asc Example h3 if the character string is not empty output its ASCII value cfif IsDefined FORM charVals cfif FORM charVals...

Страница 489: ...inNum cfif FORM SinNum LESS THAN OR EQUAL TO 1 cfif FORM SinNum GREATER THAN OR EQUAL TO 1 ASin cfoutput FORM SinNum cfoutput cfoutput ASin FORM sinNum Radians cfoutput br or br ASin cfoutput FORM Sin...

Страница 490: ...sine of the angle to calculate in degrees and radians The value must be between 1 and 1 inclusive h4 cfif cfif form action evaltest cfm method post p Enter a number to get its arcsine in Radians and...

Страница 491: ...ans to degrees multiply radians by 180 Example h3 Atn Example h3 output its Atn value cfif IsDefined FORM AtnNum cfif IsNumeric FORM AtnNum Atn cfoutput FORM AtnNum cfoutput is cfoutput Atn FORM AtnNu...

Страница 492: ...function is obsolete Use the newer security tools see Conversion functions on page 453 and Chapter 16 Securing Applications in ColdFusion MX Developer s Guide History ColdFusion MX This function is o...

Страница 493: ...n is obsolete Use the newer security tools see Conversion functions on page 453 and Chapter 16 Securing Applications in ColdFusion MX Developer s Guide History ColdFusion MX This function is obsolete...

Страница 494: ...media recommends that you use the BinaryDecode function not the ToBinary base64data function to convert Base64 encoded data to binary data in all new applications See the following pages for additiona...

Страница 495: ...inary data cfscript binencode BinaryEncode binimage Form binEncoding bindecode BinaryDecode binencode Form binEncoding cfscript Write the converted results to a file cffile action write file C temp he...

Страница 496: ...nary format use the BinaryDecode function Macromedia recommends that you use the BinaryEncode function and not the ToBase64 binarydata function to convert binary data to Base64 data in all new applica...

Страница 497: ...ert the read data to binary encoding and back to binary data cfscript binencode BinaryEncode binimage Form binEncoding bindecode BinaryDecode binencode Form binEncoding cfscript Write the converted re...

Страница 498: ...o BitNot BitOr BitXor Parameters Usage Bit functions operate on 32 bit signed integers in the range 2147483648 2147483647 Example h3 BitAnd Example h3 p Returns the bitwise AND of two long integers p...

Страница 499: ...signed integers in the range 2147483648 2147483647 Example h3 BitMaskClear Example h3 p Returns number bitwise cleared with length bits beginning from start p BitMaskClear 255 4 4 cfoutput BitMaskClea...

Страница 500: ...igned integers in the range 2147483648 2147483647 Example h3 BitMaskRead Example h3 p Returns integer created from em length em bits of em number em beginning with em start em p BitMaskRead 255 4 4 cf...

Страница 501: ...in the range 2147483648 2147483647 Example h3 BitMaskSet Example h3 p Returns number bitwise masked with length bits of mask beginning at start p BitMaskSet 255 255 4 4 cfoutput BitMaskSet 255 255 4...

Страница 502: ...nctions Function syntax BitNot number See also BitAnd BitOr BitXor Parameters Usage Bit functions operate on 32 bit signed integers in the range 2147483648 2147483647 Example h3 BitNot Example h3 p Re...

Страница 503: ...BitAnd BitNot BitXor Parameters Usage Bit functions operate on 32 bit signed integers in the range 2147483648 2147483647 Example h3 BitOr Example h3 p Returns the bitwise OR of two long integers p Bit...

Страница 504: ...tions operate on 32 bit signed integers in the range 2147483648 2147483647 Example h3 BitSHLN Example h3 p Returns the number bitwise shifted without rotation to the left by count bits p BitSHLN 1 1 c...

Страница 505: ...functions operate on 32 bit signed integers in the range 2147483648 2147483647 Example h3 BitSHRN Example h3 p Returns a number bitwise shifted without rotation to the right by count bits p BitSHRN 1...

Страница 506: ...BitAnd BitNot BitOr Parameters Usage Bit functions operate on 32 bit signed integers in the range 2147483648 2147483647 Example h3 BitXOr Example h3 p Returns the bitwise XOR of two long integers p Bi...

Страница 507: ...than a given number Category Mathematical functions Function syntax Ceiling number See also Int Fix Round Parameters Example h3 Ceiling Example h3 cfoutput p The ceiling of 3 4 is ceiling 3 4 p The ce...

Страница 508: ...ect In releases of ColdFusion through ColdFusion MX 6 1 you had to use the ToBase64 function to convert the string to Base64 and then use the ToBinary function to convert strings to binary data Parame...

Страница 509: ...charencode CharsetEncode chardecode Form charEncoding cfscript Display the input values and results cfoutput h3 Parameter Settings h3 p b The string b br Form myString p p b The character encoding b...

Страница 510: ...hapter 3 ColdFusion Functions textArea name myString cols 40 rows 5 WRAP VIRTUAL The following four characters are not in all character encodings textArea br br input type Submit value convert my data...

Страница 511: ...mmends that you use this function and not the ToString function to convert binary data to strings in all new applications Parameter Description binaryobject A variable containing binary data to decode...

Страница 512: ...Encoding charencode CharsetEncode chardecode Form charEncoding cfscript Display the input values and results cfoutput h3 Parameter Settings h3 p b The string b br Form myString p p b The character enc...

Страница 513: ...CharsetEncode 513 textArea name myString cols 40 rows 5 WRAP VIRTUAL The following four characters are not in all character encodings textArea br br input type Submit value convert my data form...

Страница 514: ...hr 13 returns a carriage return character The two character string Chr 13 Chr 10 returns a Windows newline Note For a complete list of the Unicode characters and their codes see www unicode org charts...

Страница 515: ...Chr 515 maxlength 5 p input type Submit name input type RESET cfform...

Страница 516: ...tring Cjustify FORM justifyString 35 cfif html head title CJustify Example title head body h3 CJustify h3 p Enter a string it will be center justified within the sample field form action cjustify cfm...

Страница 517: ...function performs a I case sensitive I comparison of two strings cfif IsDefined FORM string1 cfset comparison Compare FORM string1 FORM string2 switch on the variable to give various responses cfswitc...

Страница 518: ...the default case h3 CFDEFAULTCASE cfswitch cfif form action compare cfm method post p String 1 br input type Text name string1 p String 2 br input type Text name string2 p input type Submit value Com...

Страница 519: ...CompareNoCase Example H3 P This function performs a I case insensitive I comparison of two strings CFIF IsDefined form string1 CFSET comparison Comparenocase form string1 form string2 switch on the v...

Страница 520: ...unctions CFSWITCH CFIF FORM ACTION comparenocase cfm METHOD POST P String 1 BR INPUT TYPE Text NAME string1 P String 2 BR INPUT TYPE Text NAME string2 P INPUT TYPE Submit VALUE Compare these Strings N...

Страница 521: ...0 To test for a 0 value check whether the value is less than 0 0000000000001 Example h3 Cos Example h3 Calculate cosine if form has been submitted cfif IsDefined FORM cosNum Make sure input is a numb...

Страница 522: ...ColdFusion Functions cfif cfif form action CGI script_name method post Enter an angle in degrees to get its cosine br input type Text name cosNum size 15 br br input type Submit name nbsp nbsp input t...

Страница 523: ...value generated with CreateDate CFSET yourDate CreateDate form year form month form day cfoutput ul li Formatted with CreateDate CreateDate form year form month form day li Formatted with CreateDateT...

Страница 524: ...at CreateODBCDate yourDate mmmm d yyyy li Formatted with CreateODBCDateTime and DateFormat DateFormat CreateODBCDateTime yourDate d m yy ul cfoutput CFIF CFFORM ACTION createdate cfm METHOD POST p Ent...

Страница 525: ...month form day form hour form minute form second cfoutput ul li Formatted with CreateDate CreateDate form year form month form day li Formatted with CreateDateTime CreateDateTime form year form month...

Страница 526: ...ar month and day in integer format for a date to view PRE Year CFINPUT TYPE Text NAME year VALUE 1998 VALIDATE integer REQUIRED Yes Month CFINPUT TYPE Text NAME month VALUE 6 RANGE 1 12 MESSAGE Please...

Страница 527: ...hod in the CFC file For more information see ColdFusion MX Developer s Guide For CORBA object changed the Naming Service separator format for addresses from a dot to a forward slash For example if con...

Страница 528: ...ity Note On UNIX this function does not support COM objects Returns A COM object Function syntax CreateObject type class context serverName See also ReleaseComObject cfobject Chapter 38 Integrating CO...

Страница 529: ...ject 529 Usage The following example creates the Windows Collaborative Data Objects CDO for NTS NewMail object to send mail You would use this code within a cfscript tag Mailer CreateObject COM CDONTS...

Страница 530: ...ly with the identical character casing In the following example the CFScript statements assign the tellTimeCFC variable to the tellTime component using the CreateObject function The CreateObject funct...

Страница 531: ...formats Macromedia Eng CF Macromedia current Eng current CF Parameter Description type Type of object to create com corba java component webservice context IOR ColdFusion uses IOR to access CORBA ser...

Страница 532: ...ct s naming context in the naming service You must provide the object s attributes method names and method signatures This function supports user defined types structures arrays and sequences Example...

Страница 533: ...hod with appropriate arguments to call an instance of the class For example cfset ret myObj init arg1 arg2 Calling a public method on the object without first calling the init method invokes a static...

Страница 534: ...2001 TemperatureService wsdl xlatstring ws getTemp zipcode 55987 writeoutput The temperature at 55987 is xlatstring cfscript Parameter Description type Type of object to create com corba java componen...

Страница 535: ...value use the attributes validate integer and range 1 12 Example h3 CreateODBCDate Example h3 CFIF IsDefined form year p Your date value generated with CreateDateTime cfset yourDate CreateDateTime for...

Страница 536: ...quired yes Month cfinput type text name month value 6 range 1 12 message please enter a month 1 12 validate integer REQUIRED Yes Day cfinput type text name day value 8 range 1 31 MESSAGE Please enter...

Страница 537: ...ateTime Example h3 cfif IsDefined form year Your date value generated using CreateDateTime cfset yourDate CreateDateTime form year form month form day form hour form minute form second cfoutput ul li...

Страница 538: ...NAME month VALUE 6 RANGE 1 12 MESSAGE Enter a month 1 12 VALIDATE integer REQUIRED Yes Day cfinput type text name day value 8 range 1 31 MESSAGE Enter a day of the month 1 31 VALIDATE integer REQUIRED...

Страница 539: ...ime value created with CreateTime cfset yourTime CreateTime form hour form minute form second cfoutput ul li Formatted with CreateODBCTime CreateODBCTime yourTime li Formatted with TimeFormat TimeForm...

Страница 540: ...IsDefined FORM hour Your time value presented using CreateTime time function cfset yourTime CreateTime FORM hour FORM minute FORM second cfoutput ul li Formatted with timeFormat TimeFormat yourTime li...

Страница 541: ...CreateTime 541 MESSAGE You must enter a value for seconds 0 59 VALIDATE integer REQUIRED Yes PRE p input type submit name input type reset cfform...

Страница 542: ...ibute of cfquery and the original query date falls within the time span you define cached query data is used In this case the CreateTimeSpan function is used to define a period of time from the presen...

Страница 543: ...you are displaying cfoutput query GetParks StartRow StartRow maxrows maxrows TR TD valign top bgcolor ffffed b GetParks CurrentRow b TD TD valign top font size 1 ParkName font TD TD valign top font s...

Страница 544: ...a user defined function called CreateGUID which converts CFML UUIDs to UUID Microsoft GUID format available on the web at www cflib org Use this function to generate a persistent identifier in a distr...

Страница 545: ...g a date time object as a string you must enclose it in quotation marks Otherwise it is interpreted as a numeric representation of a date time object Example This example shows the use of DateAdd cfpa...

Страница 546: ...ers cfcase cfcase value m months cfcase cfcase value y days of year cfcase cfcase value w weekdays cfcase cfcase value ww weeks cfcase cfcase value h hours cfcase cfcase value n minutes cfcase cfcase...

Страница 547: ...7 option value yyyy years option value m selected months option value d days option value ww weeks option value h hours option value n minutes option value s seconds select input type Submit value Sub...

Страница 548: ...h3 p The DateCompare function compares two date time values cfif IsDefined FORM date1 cfif IsDate FORM date1 and IsDate FORM date2 cfset comparison DateCompare FORM date1 FORM date2 FORM precision swi...

Страница 549: ...date2 cfoutput Date 2 h3 I The dates are not equal I cfcase cfdefaultcase h3 This is the default case h3 cfdefaultcase cfswitch cfelse h3 Enter two valid date values h3 cfif cfif form action datecompa...

Страница 550: ...550 Chapter 3 ColdFusion Functions option select p input type Submit value Compare these dates name input type reset form...

Страница 551: ...on for example DateConvert CreateDate 2001 3 3 Example h3 DateConvert Example h3 This shows conversion of current date time to UTC and back cfset curDate Now p cfoutput The current date and time curDa...

Страница 552: ...r required Yes td tr tr td Month td td input type Text name month value 6 range 1 12 message Enter a month 1 12 validate integer required Yes td tr tr td Day td td input type Text name day value 8 ran...

Страница 553: ...ses Changed the w and ww masks they determine the number of full weeks between the two dates Parameters Usage The DateDiff function determines the number of complete datepart units between the two dat...

Страница 554: ...se value y days cfcase cfcase value d days cfcase cfcase value w weekdays cfcase cfcase value ww weeks cfcase cfcase value h hours cfcase cfcase value n minutes cfcase cfcase value s seconds cfcase cf...

Страница 555: ...UT Date 2 input type Text name date2 value CFOUTPUT DateFormat Now CFOUTPUT What kind of unit to show difference select name type option value yyyy selected years option value q quarters option value...

Страница 556: ...D 9999 AD mask Characters that show how ColdFusion displays a date d Day of the month as digits no leading zero for single digit days dd Day of the month as digits leading zero for single digit days d...

Страница 557: ...les see TechNote 22183 ColdFusion Server 5 and 4 5 x with Oracle Formatting Date and Time Query Results on the Macromedia website at www coldfusion com Support KnowledgeBase SearchForm cfm Note The Da...

Страница 558: ...as a string you must enclose it in quotation marks Otherwise it is interpreted as a numeric representation of a date time object Example This example shows information available from DatePart cfset to...

Страница 559: ...todayDate li month DatePart m todayDate li day of year DatePart y todayDate li day DatePart d todayDate li weekday DatePart w todayDate li week DatePart ww todayDate li hour DatePart h todayDate li m...

Страница 560: ...Now function as the date parameter of this function for example Day CreateDate 2001 3 3 Example h3 Day Example h3 cfif IsDefined FORM year p More information about your date cfset yourDate CreateDate...

Страница 561: ...ow function as the date parameter of this function for example DayOfWeek CreateDate 2001 3 3 Example h3 DayOfWeek Example h3 cfif IsDefined FORM year More information about your date cfset yourDate Cr...

Страница 562: ...the DayOfWeekAsString function It is the action page for a form that submits year month and day fields h3 DayOfWeekAsString Example h3 cfif IsDefined FORM year More information about your date cfset y...

Страница 563: ...Now function as the date parameter of this function for example DayOfYear CreateDate 2001 3 3 Example h3 Day7OfYear Example h3 cfif IsDefined FORM year More information about your date cfset yourDate...

Страница 564: ...as the date parameter of this function for example DaysInMonth CreateDate 2001 3 3 Example h3 DaysInMonth Example h3 cfif IsDefined FORM year More information about your date cfset yourDate CreateDate...

Страница 565: ...Note You can pass the CreateDate function or the Now function as the date parameter of this function for example DaysInYear CreateDate 2001 3 3 Example h3 DaysInYear Example h3 cfif IsDefined FORM yea...

Страница 566: ...atically evaluates its second and third parameters as expressions You can use the DE function to prevent the function from evaluating a string parameter that is to be output as a variable and should n...

Страница 567: ...and surrounds it in quotation marks 5 The IIF function returns the string Green including the quotation marks 6 The cfset tag gets the expression result Green and sets the value of the myresult varia...

Страница 568: ...Error B Try a simple expression such as 2 2 h3 cfoutput Display the diagnostic message from ColdFusion p cfcatch message cfoutput cfcatch cftry cfif h3 Enter any valid ColdFusion expression h3 cfform...

Страница 569: ...parator Category Display and formatting functions Function syntax DecimalFormat number See also DollarFormat NumberFormat Parameters Example h3 DecimalFormat Function h3 p Returns a number to two deci...

Страница 570: ...nction syntax DecrementValue number See also IncrementValue Parameters Example h3 DecrementValue Example h3 p Returns the integer part of a number decremented by one p DecrementValue 0 cfoutput Decrem...

Страница 571: ...the following algorithms CFMX_COMPAT the algorithm used in ColdFusion MX and prior releases This algorithm is the least secure option default AES the Advanced Encryption Standard specified by the Nati...

Страница 572: ...g if the form has been submitted cfif IsDefined Form myString cfscript GenerateSecretKey does not generate key for the CFMX_COMPAT algorithm so use the key from the form if Form myAlgorithm EQ CFMX_CO...

Страница 573: ...tion option DESEDE option select br br b Input your key b used for CFMX_COMPAT encryption only br input type Text name myKey value MyKey br br b Enter string to encrypt b br textArea name myString col...

Страница 574: ...e h3 DeleteClientVariable Example h3 p This view only example deletes a client variable called User_ID if it exists in the list of client variables returned by GetClientVariablesList p This example re...

Страница 575: ...3 h3 Enter a directory to check for existence h2 form action directoryexists cfm method post input type text name yourDirectory br input type submit name submit form cfif IsDefined FORM yourDirectory...

Страница 576: ...ting functions Function syntax DollarFormat number See also DecimalFormat NumberFormat Parameters Example This example shows the use of DollarFormat h3 DollarFormat Example h3 cfloop from 8 to 50 inde...

Страница 577: ...structures and queries Note The Duplicate function throws an exception if you attempt to duplicate a CFC Note With this function you cannot duplicate a COM CORBA or JAVA object returned from the cfobj...

Страница 578: ...use to decrypt the string ColdFusion MX installs a cryptography library with the following algorithms CFMX_COMPAT the algorithm used in ColdFusion MX and prior releases This algorithm is the least sec...

Страница 579: ...than the other available algorithms Example The following example encrypts and decrypts a text string It lets you specify the encryption algorithm and encoding technique It also has a field for a key...

Страница 580: ...br select size 1 name myAlgorithm option selected CFMX_COMPAT option option AES option option DES option option DESEDE option select br br b Input your key b used for CFMX_COMPAT encryption only br in...

Страница 581: ...ion is useful for forming one variable from multiple variables For example to reference a column of the query qNames with a variable var using an index value to traverse rows you could use the followi...

Страница 582: ...number FORM number br FORM number raised to the E power exp FORM number cfif FORM number LTE 0 br You must enter a positive real number to see its natural logarithm cfelse br The natural logarithm of...

Страница 583: ...Changed behavior for the relative_path parameter this function can now accept an absolute or relative path in the relative_path parameter To resolve a path this function uses virtual mappings that ar...

Страница 584: ...Your file was not found in this directory br Here is a list of the other files in this directory use CFDIRECTORY to give the contents of the snippets directory order by name and size CFDIRECTORY DIRE...

Страница 585: ...MX in the Server Configuration as a Windows service by default it runs under the local system account which does not have sufficient privileges to access remote systems You can change this however on...

Страница 586: ...tput cfset stringToSearch The quick brown fox jumped over the lazy dog find the stringToSearch br find the stringToSearch 35 br find no such substring stringToSearch br br findnocase the stringToSearc...

Страница 587: ...rns 33 as the first position found because the is lowercase The FindNoCase function returns 1 as the first postion because the case is ignored cfset stringToSearch The quick brown fox jumped over the...

Страница 588: ...e cfset stringToSearch The quick brown fox jumped over the lazy dog find the stringToSearch br find the stringToSearch 35 br find no such substring stringToSearch br br findnocase the stringToSearch b...

Страница 589: ...date See also Day DayOfWeek DayOfWeekAsString DayOfYear DaysInMonth DaysInYear Parameters Usage When passing a date time value as a string you must enclose it in quotation marks Otherwise it is inter...

Страница 590: ...matical functions Function syntax Fix number See also Ceiling Int Round Parameters Example h3 Fix Example h3 p Fix returns the closest integer less than the number if the number is greater than or equ...

Страница 591: ...ecified by Radix p cfoutput br FormatBaseN 10 2 FormatBaseN 10 2 br FormatBaseN 1024 16 FormatBaseN 1024 16 br FormatBaseN 125 10 FormatBaseN 125 10 br FormatBaseN 10 75 2 FormatBaseN 10 75 2 cfoutput...

Страница 592: ...Sun Java 1 4 2 runtime that includes the Sun JCE default security provider This provider includes the algorithms listed in the Parameters section The JCE framework includes facilities for using other...

Страница 593: ...generate a secret key else theKey generateSecretKey Form myAlgorithm Encrypt the string encrypted encrypt Form myString theKey Form myAlgorithm Form myEncoding Decrypt it decrypted decrypt encrypted t...

Страница 594: ...ed for CFMX_COMPAT encryption only br input type Text name myKey value foobar br br b Enter string to encrypt b br textArea name myString cols 40 rows 5 WRAP VIRTUAL This string will be encrypted you...

Страница 595: ...Applications in ColdFusion MX Developer s Guide History ColdFusion MX Added this function Usage This function works with cflogin authentication or web server authentication It checks for a logged in u...

Страница 596: ...hapter 11 Creating and Using Custom CFML Tags in ColdFusion MX Developer s Guide Parameters Example This example shows the use of GetBaseTagData function Typically used in custom tags cfif trim inCust...

Страница 597: ...he ancestor tag list cfif cfelseif cfelse cfswitch cfcase cfdefaultcase cftry cfcatch This function displays the following tags only under the following conditions cfloop if it uses a query attribute...

Страница 598: ...eturns The absolute path of the application base page as a string Category Other functions System functions Function syntax GetBaseTemplatePath See also GetCurrentTemplatePath FileExists ExpandPath Ex...

Страница 599: ...GetClientVariablesList Example h3 p This view only example deletes a client variable called User_ID if it exists in the list of client variables returned by GetClientVariablesList p This example requi...

Страница 600: ...ext GetRequest GetContextPath On J2EE configurations it returns the path from the Web root to the J2EE context root of the ColdFusion MX J2EE application On server configurations it returns the empty...

Страница 601: ...sts ExpandPath Usage If the function call is made from a page included with a cfinclude tag this function returns the page path of an included page Contrast this with the GetBaseTemplatePath function...

Страница 602: ...h cfif IsDefined FORM yourFile cfif FORM yourFile is not cfset yourFile FORM yourFile cfif FileExists ExpandPath yourfile p Your file exists in this directory You entered the correct file name GetFile...

Страница 603: ...mPath 603 cfoutput form action getdirectoryfrompath cfm METHOD post H3 Enter the name of a file in this directory I FONT SIZE 1 try expandpath cfm FONT I H3 input type Text NAME yourFile input type Su...

Страница 604: ...ds of a form that was submitted to the current page The default encoding if none has been explicitly set is UTF 8 For more information see www iana org assignments character sets Example This example...

Страница 605: ...GetEncoding 605 WriteOutput The encoding is theEncoding cfscript cfif...

Страница 606: ...the exception object To get the current exception object you must call GetException on the Java object before other methods are invoked on it Example Create the Java object reference cfobject action c...

Страница 607: ...is not cfset yourFile FORM yourFile cfif FileExists ExpandPath yourfile p Your file exists in this directory You entered the correct file name GetFileFromPath thisPath yourfile cfelse p Your file was...

Страница 608: ...lable in ColdFusion Returns A structure of functions Category System functions Function syntax GetFunctionList Example This example shows the use of GetFunctionList cfset fList GetFunctionList cfoutpu...

Страница 609: ...at implements the GatewayHelper class For example an instant messaging event gateway might make buddy list management functions available in a GatewayHelper object An event gateway listener CFC can ge...

Страница 610: ...ludes an addBuddy method that takes a single String parameter you could use the following code to get the GatewayHelper object and add a buddy to the buddies list h3 GetGatewayHelper Example h3 cfscri...

Страница 611: ...on cfset x GetHttpRequestData cfoutput table cellpadding 2 cellspacing 2 tr td b HTTP Request item b td td b Value b td tr cfloop collection x headers item http_item tr td http_item td td StructFind x...

Страница 612: ...612 Chapter 3 ColdFusion Functions tr td server_protocol td td x protocol td tr table b http_content x content b cfoutput...

Страница 613: ...only used in Internet protocols including HTTP Category Date and time functions International functions Function syntax GetHttpTimeString date_time_object See also GetLocale GetTimeZoneInfo SetLocale...

Страница 614: ...erity collections Category Full text search functions Query functions Function syntax GetK2ServerDocCount See also GetK2ServerDocCountLimit History ColdFusion MX 6 1 Deprecated this function It might...

Страница 615: ...ion syntax GetK2ServerDocCountLimit See also GetK2ServerDocCount History ColdFusion MX 6 1 Deprecated this function It might not work and it might cause an error in later releases ColdFusion MX Added...

Страница 616: ...ame function which returns portugu s Brasil and catal Espanya This function determines whether a locale value is set for ColdFusion MX The value is set with the SetLocale function If the ColdFusion MX...

Страница 617: ...e to the submitted value and save the old ColdFusion locale name cfset oldlocale SetLocale form mylocale Get the current locale It should have changed New locale GetLocale br cfif Self submitting form...

Страница 618: ...n the current locale and in other locales It lets you select a locale from all supported locales changes the ColdFusion MX locale to the selected locales and displays the old and new locale names html...

Страница 619: ...name in current locale GetLocaleDisplayName oldlocale br Old locale s display name in en_US GetLocaleDisplayName oldlocale en_US br cfif Self submitting form to select the new locale cfform h3 Please...

Страница 620: ...story ColdFusion MX 7 Added support for getting query object metadata ColdFusion MX Added this function Parameters Usage This function provides information about application data and lets applications...

Страница 621: ...r Custom Tag Paths page output Value of the cfcomponent tag output attribute if any path Absolute path to the component properties Array of structures containing metadata specified by the component s...

Страница 622: ...data getMetaData componentutils cfscript h4 Metadata for the CFC component utilities h4 cfdump var utilmetadata use GetMetadata to get the names and data types of the fields in the cfdocexamples Emplo...

Страница 623: ...CT FROM Employees cfquery cfset employeemeta getMetaData getemployees h4 The Employees table has the following columns h4 cfloop index i from 1 to arrayLen employeemeta cfoutput employeemeta i name em...

Страница 624: ...is otherwise displayed in the Windows PerfMonitor simple_load Returns an integer value that is computed from the state of the server s internal queues Indicates the overall server load prev_req_time R...

Страница 625: ...r you can set the maximum number of requests that run concurrently ReqTimedOut Number of HTTP requests that timed out while in the staging queue or during processing BytesIn Number of bytes in HTTP re...

Страница 626: ...e equivalent of the corresponding standard JSP tags You use these methods to call JSP pages and servlets For example you use the following code in CFScript to include the JSP page hello jsp and pass i...

Страница 627: ...Returns An initialization file as a struct whose format is as follows Each initialization file section name is a key in the struct Each list of entries in a section of an initialization file is a val...

Страница 628: ...et the value of timeout in an initialization file Enter the full path of your initialization file and submit the form If the form was submitted it gets the initialization path and timeout value specif...

Страница 629: ...GetProfileString 629 tr td input type Submit name Submit value Submit td td td tr table form...

Страница 630: ...ion error Unable to use getSOAPRequest not processing a web service request If you call this function from within a web service CFC you can omit the webservice argument The function executes against t...

Страница 631: ...SOAPRequest is called from the client here whereas often it would be called from within the web service CFC cfscript ws CreateObject webservice http localhost soapheaders headerservice cfc WSDL ws ech...

Страница 632: ...er as a string If you specify True for the asXML parameter ColdFusion retrieves the header as raw XML This function throws an error if it is invoked in a context that is not a web service request Use...

Страница 633: ...et password getSOAPRequestHeader http mynamespace password cfset return return The service saw password password cfset xmlpassword getSOAPRequestHeader http mynamespace password TRUE cfset return retu...

Страница 634: ...makes a request to execute the echo_me function of the headerservice cfc web service Following the request the example calls the GetSOAPResponse function to get the SOAP response and then calls cfdum...

Страница 635: ...i type attribute is not available ColdFusion attempts to retrieve the header as a string If you specify True for the asXML parameter ColdFusion retrieves the header as raw XML Used within CFML code by...

Страница 636: ...ord XmlAttributes xsi type xsd string addSOAPRequestHeader ws ignoredNameSpace ignoredName doc Invoke the web service operation ret ws echo_me argument Get the first header as an object string and as...

Страница 637: ...ncluding a trailing slash as a string Category System functions Function syntax GetTempDirectory See also GetTempFile History ColdFusion MX Changed behavior on Windows this function now returns the te...

Страница 638: ...System functions Function syntax GetTempFile dir prefix See also GetTempDirectory Parameters Example h3 GetTempFile Example h3 p The temporary directory for this ColdFusion Server is cfoutput GetTempD...

Страница 639: ...ption This function is deprecated Use the GetBaseTemplatePath function instead Gets the absolute path of an application s base page History ColdFusion MX Deprecated this function It might not work and...

Страница 640: ...L code segments or other page processing elements The value of the counter has no meaning To generate useful timing values take the difference between the results of two GetTickCount calls Example Set...

Страница 641: ...zone east of UTC such as a zone in Germany utcHourOffset offset in hours of local time from UTC utcMinuteOffset offset in minutes beyond the hours offset For North America this is 0 For countries tha...

Страница 642: ...tan red pink brown red three 2 This function call requests element number 2 from the string using the delimiter The output is as follows red black tan Example B Consider the following code cfset myst...

Страница 643: ...thirteen and four In the following call against mystring no spaces are specified in delimiters it is omitted so the function uses the space character as the string delimiter br cfoutput GetToken myst...

Страница 644: ...This substring is five nine zero Example h3 GetToken Example h3 cfif IsDefined FORM yourString set delimiter cfif FORM yourDelimiter is not cfset yourDelimiter FORM yourDelimiter cfelse cfset yourDeli...

Страница 645: ...used in ColdFusion MX and prior releases SHA Generates a 28 character string using the Secure Hash Standard SHA 1 algorithm specified by Nation Institute of Standards and Technology NIST FIPS 180 2 S...

Страница 646: ...sm for generating identical hash values on systems with different default encodings ColdFusion uses a default encoding of UTF 8 unless you modify the defaultCharset entry in the neo runtime xml file E...

Страница 647: ...rm for entering ID and password form action CGI SCRIPT_NAME method post b User ID b input type text name UserID br b Password b input type text name password br br input type Submit value Encrypt my S...

Страница 648: ...e When passing a date time value as a string you must enclose it in quotation marks Otherwise it is interpreted as a number representation of a date time object Example This example shows the use of H...

Страница 649: ...at string version See also HTMLEditFormat Parameters Usage This function converts the following characters to HTML character entities This function typically increases the length of a string This can...

Страница 650: ...then View it using your browser s the View Source command cfset testString This is a test this is another This text is in angle brackets Previous line was blank cfoutput h3 The text without processin...

Страница 651: ...lp protect ColdFusion pages that return user provided data to the client browser from cross site scripting attacks However the scriptprotect attribute of the cfapplication tag or the equivalent This s...

Страница 652: ...of HTMLCodeFormat and HTMLEditFormat View it in your browser then View it using your browser s the View Source command cfset testString This is a test this is another This text is in angle brackets P...

Страница 653: ...eters Usage The IIf function is a shortcut for the following construct cfif condition cfset result Evaluate string_expression1 cfelse cfset result Evaluate string_expression2 cfif The expressions stri...

Страница 654: ...t throw an error In the following example LocalVar is undefined however if you omit number signs around LocalVar the code works properly cfoutput IIf IsDefined LocalVar LocalVar DE The variable is not...

Страница 655: ...IIf 655 cfoutput IIf Hour Now GTE 12 DE It is afternoon or evening DE It is morning cfoutput b...

Страница 656: ...syntax IncrementValue number See also DecrementValue Parameters Example h3 IncrementValue Example h3 p Returns the integer part of a number incremented by one p IncrementValue 0 cfoutput IncrementValu...

Страница 657: ...seN 1024 16 FormatBaseN 1024 16 br FormatBaseN 125 10 FormatBaseN 125 10 br FormatBaseN 10 75 2 FormatBaseN 10 75 2 cfoutput h3 InputBaseN Example h3 p InputBaseN returns the number obtained by conver...

Страница 658: ...ition GT Len MyString cfoutput p This string only has Len MyString characters therefore you cannot insert the substring FORM mySubString at position FORM insertPosition cfoutput cfif cfelse cfoutput p...

Страница 659: ...ns An integer as a string Category Mathematical functions Function syntax Int number See also Ceiling Fix Round Parameters Example h3 Int Example h3 p Int returns the closest integer smaller than a nu...

Страница 660: ...s True In earlier releases it returns False Changed behavior this function can be used on XML objects Parameters Usage Use this function to determine whether a value is an array or query column This f...

Страница 661: ...is obsolete Use the newer security tools see Conversion functions on page 453 and Chapter 16 Securing Applications in ColdFusion MX Developer s Guide History ColdFusion MX This function is obsolete It...

Страница 662: ...is function is obsolete Use the newer security tools see Conversion functions on page 453 and Chapter 16 Securing Applications in ColdFusion MX Developer s Guide History ColdFusion MX This function is...

Страница 663: ...32 to 255 from the ASCII table b br br cfoutput htmleditformat charData cfoutput br br Create a Base 64 representation of this string cfset data64 toBase64 charData Convert string to binary cfset bina...

Страница 664: ...664 Chapter 3 ColdFusion Functions cfelse h3 Conversion error h3 cfif...

Страница 665: ...oolean Example h3 cfif IsDefined FORM theTestValue cfif IsBoolean FORM theTestValue h3 The expression cfoutput DE FORM theTestValue cfoutput is Boolean h3 cfelse h3 The expression cfoutput DE FORM the...

Страница 666: ...rst instantiate the component Note To prevent undefined variable exceptions always precede IsCustomFunction with an IsDefined test as shown in the example Example h3 IsCustomFunction Example h3 cfscri...

Страница 667: ...Example using a CFC defined in TestCFC cfc cfobject component TestCFC name myTestCFCobject CFIF IsDefined myTestCFCobject testFunc AND IsCustomFunction myTestCFCobject testFunc myTestCFCobject testFun...

Страница 668: ...This function checks against U S date formats only For other date support see LSDateFormat A date time object falls in the range 100 AD 9999 AD Example h3 IsDate Example h3 cfif IsDefined FORM theTes...

Страница 669: ...unctions Function syntax IsDebugMode See also cfsetting Description If debugging output is enabled in ColdFusion Administrator and has not been overridden by setting the cfsetting tag showDebugOutput...

Страница 670: ...r this function can process only the following constructs A simple variable A named variable with dot notation A named structure with dot notation for example mystruct key Parameters Usage When workin...

Страница 671: ...ime through this template the variable form myString has not yet been defined so we do not try to evaluate it cfif form action CGI Script_Name method POST input type Text name MyString value My sample...

Страница 672: ...sion functions Full text search functions Query functions Function syntax IsK2ServerABroker See also GetK2ServerDocCountLimit IsK2ServerDocCountExceeded IsK2ServerOnline History ColdFusion MX 6 1 Depr...

Страница 673: ...sion functions Full text search functions Query functions Function syntax IsK2ServerDocCountExceeded See also GetK2ServerDocCountLimit IsK2ServerABroker History ColdFusion MX 6 1 Deprecated this funct...

Страница 674: ...s available to perform a search False otherwise Category Decision functions Full text search functions Query functions Function syntax IsK2ServerOnline See also IsK2ServerABroker History ColdFusion MX...

Страница 675: ...ined FORM theTestValue cfif IsLeapYear FORM theTestValue h3 The year value cfoutput DE FORM theTestValue cfoutput is a Leap Year h3 cfelse h3 The year value cfoutput DE FORM theTestValue cfoutput is n...

Страница 676: ...ters Example h3 IsNumeric Example h3 cfif IsDefined FORM theTestValue cfif IsNumeric FORM theTestValue h3 The string cfoutput DE FORM theTestValue cfoutput can be converted to a number h3 cfelse h3 Th...

Страница 677: ...s valid date string formats to date time objects which are real numbers Example h3 IsNumericDate Example h3 cfif IsDefined form theTestValue test if the value represents a number or a pre formatted Da...

Страница 678: ...678 Chapter 3 ColdFusion Functions p input type Text name TheTestValue value CFOUTPUT Now CFOUTPUT input type Submit value Is it a Date name form...

Страница 679: ...tory ColdFusion MX Added this function Parameters Usage This function returns False for query and XML objects Example to use this example create a color cfc component as follows cfcomponent cffunction...

Страница 680: ...680 Chapter 3 ColdFusion Functions returnVariable myColor cfinvoke cfif IsDefined myColor Output the returned variable The value of myColor cfoutput myColor cfoutput p cfif cfif...

Страница 681: ...n is obsolete Use the newer security tools see Conversion functions on page 453 and Chapter 16 Securing Applications in ColdFusion MX Developer s Guide History ColdFusion MX This function is obsolete...

Страница 682: ...is run the value of GetEmployees is cfoutput GetEmployees cfoutput cfif IsSimpleValue GetEmployees p GetEmployees is currently a simple value cfif make a query on the snippets datasource cfquery name...

Страница 683: ...he query is run the value of GetEmployees is cfoutput GetEmployees cfoutput cfif IsSimpleValue GetEmployees p GetEmployees is currently a simple value cfif make a query on the snippets datasource cfqu...

Страница 684: ...ce that illustrates the operation of the IsSOAPRequest function and also provides a web service that illustrates the operation of other ColdFusion SOAP functions Save the following code as headerservi...

Страница 685: ...n br as XML xmlpassword Add a header as a string cfset addSOAPResponseHeader http www tomj org myns returnheader AUTHORIZED VALUE false Add a second header using a CFML XML value cfset doc XmlNew cfse...

Страница 686: ...le shows the use of IsStruct p This file is similar to addemployee cfm which is called by StructNew StructClear and StructDelete It is an example of a custom tag used to add employees Employee informa...

Страница 687: ...IsStruct 687 cfoutput cfquery cfif cfoutput hr Employee Add Complete cfoutput cfcase cfswitch...

Страница 688: ...curing Applications in ColdFusion MX Developer s Guide History ColdFusion MX Added this function Parameters Usage Role names are case sensitive To check if a user is in multiple roles specify them in...

Страница 689: ...cision functions Function syntax IsValid type value isValid range value min max isValid regex or regular_expression value pattern See also cfparam cfform IsBoolean IsDate IsNumeric IsSimpleValue Valid...

Страница 690: ...ue equivalent to the IsNumeric function guid a Universally Unique Identifier of the form XXXXXXXX XXXX XXXX XXXX XXXXXXXXXXXX where X is a hexadecimal number integer an integer query a query object eq...

Страница 691: ...il form emailAddr and isValid telephone form phoneNo cfoutput Application code to update the database goes here h3 The email address and phone number for user Form UserID have been added h3 cfoutput c...

Страница 692: ...ot a WDDX packet ColdFusion returns False In earlier releases ColdFusion threw an error Parameters Usage This function processes a WDDX packet with a validating XML parser which uses the WDDX Document...

Страница 693: ...IsWDDX 693 struct data wddxPacket hr xmp cfoutput packet xmp IsWDDX returns IsWDDX packet br cfoutput...

Страница 694: ...is well formed XML that is it conforms to all XML syntax and structuring rules The string does not have to be a complete XML document The function does not validate against a Document Type Definition...

Страница 695: ...s to see if they are well formed XML cfoutput xmlString1 contains the following text br br HTMLCodeFormat xmlstring1 Is it well formed XML text IsXML xmlString1 br br hr xmlString2 contains the follow...

Страница 696: ...turned by the XmlSearch function is an XML attribute The DOM and therefore ColdFusion MX treats XML attributes as properties of an element and does not directly expose them as DOM nodes For this reaso...

Страница 697: ...his example there is only one entry cfset lastnames XmlSearch xmlobject lastname Test objects to see if they are attributes cfoutput h3 Are the following XML Attribute nodes h3 The order element id at...

Страница 698: ...tion Parameters Example The following example creates an XML Document object and a Java object and tests whether they are XML document objects Create an XML document object cfxml variable xmlobject or...

Страница 699: ...eters Example The following example tests whether an XML document object the document root and an element are elements Create an XML document object cfxml variable xmlobject order id 4323251 customer...

Страница 700: ...ollowing components of an XML document object The document object Elements in the object XmlNode objects in an element s XmlNodes array It also returns True for XML node objects returned by the XmlSea...

Страница 701: ...see if they are XML nodes cfoutput h3 Are the following XML nodes h3 xmlobject IsXmlNode xmlobject br The items element xmlobject order items IsXmlNode xmlobject order items br The order element id a...

Страница 702: ...Example The following example tests whether an XML document object its root element and a child element are XML root elements Create an XML document object cfxml variable xmlobject xml version 1 0 enc...

Страница 703: ...st only when a method is overloaded because its arguments can take more than one data type not because the method can take a variable number of arguments JavaCast cannot be used to cast between comple...

Страница 704: ...c String fooMethod String arg return Argument was a String public String fooMethod int arg return Argument was an Integer Within ColdFusion you use the following code cfobject action create type java...

Страница 705: ...put arbitrary strings safely into JavaScript Example This example shows the use of the JSStringFormat function h3 JSStringFormat h3 cfset stringValue An example string value with a tab chr 8 a newline...

Страница 706: ...RM sampleText is not cfoutput p Your text b FORM sampleText b returned in lowercase is b LCase FORM sampleText b p cfoutput cfelse p b i Please enter some text i b p cfif cfif p Enter your text Press...

Страница 707: ...eChars leftmost characters of this string because it is not long enough p cfoutput cfelse cfoutput p Your original string strong Form myText strong p p Your changed string showing only the strong Form...

Страница 708: ...r 3 ColdFusion Functions select name RemoveChars option value 1 1 option value 3 selected 3 option value 5 5 option value 7 7 option value 9 9 select input type Submit name Submit value Remove charact...

Страница 709: ...ASCII 0 NUL character but did not process subsequent characters of the string Parameters Example h3 Len Example h3 cfif IsDefined Form MyText If len returns 0 zero then show error message cfif Len FO...

Страница 710: ...values for our list elements cfquery name GetParkInfo datasource cfdocexamples SELECT PARKNAME CITY STATE FROM PARKS WHERE PARKNAME LIKE AL cfquery cfset temp ValueList GetParkInfo ParkName Parameter...

Страница 711: ...ListAppend 711 cfoutput p The original list temp cfoutput now append a park name to the list cfset temp2 ListAppend Temp ANOTHER PARK...

Страница 712: ...s SELECT PARKNAME CITY STATE FROM Parks WHERE PARKNAME LIKE BA CFQUERY CFSET temp ValueList GetParkInfo ParkName cfoutput p The original list p temp cfoutput Change the delimiters in the list CFSET te...

Страница 713: ...aList three p Here is a list cfoutput aList cfoutput p strong ListContains strong checks for substring wo in the list elements cfoutput p nbsp nbsp nbsp Substring wo is in B element ListContains aLis...

Страница 714: ...it in the second element p nbsp nbsp nbsp strong ListContains strong cfoutput The string two is in b element ListContains aList two b of the list cfoutput nbsp nbsp nbsp p strong ListFind strong cfou...

Страница 715: ...orm letter First query to get some values for our list cfquery name GetParkInfo datasource cfdocexamples SELECT PARKNAME CITY STATE FROM Parks WHERE PARKNAME LIKE form letter cfquery cfset tempList Va...

Страница 716: ...pty list elements thus the list a b c d has four elements Example First query to get some values for our list elements CFQUERY NAME GetParkInfo DATASOURCE cfdocexamples SELECT PARKNAME CITY STATE FROM...

Страница 717: ...foutput Delete the third element from the list CFSET temp2 ListDeleteAt Temp 3 cfoutput p The changed list temp2 p I This list element br deleted_element br is no longer present at position three of t...

Страница 718: ...list form action listfind cfm method POST p Try changing the case in Leary s last name br input type Text size 25 name myString value Leary p Pick a search type select name type option value ListFind...

Страница 719: ...ListGetAt ValueList SearchEmpLastName Department temp Department can be reached at ListGetAt ValueList SearchEmpLastName Phone temp p This was the first employee found under this case sensitive last...

Страница 720: ...ind cfm method POST p Try changing the case in Leary s last name br input type Text size 25 name myString value Leary p Pick a search type select name type option value ListFind selected Case Sensitiv...

Страница 721: ...chEmpLastName Department temp Department can be reached at ListGetAt ValueList SearchEmpLastName Phone temp p This was the first employee found under this case sensitive last name search cfoutput cfif...

Страница 722: ...FROM Messages cfquery cfset temp ValueList GetMessageUser Username p Before editing the list it is nbsp cfoutput ValueList GetMessageUser Username cfoutput p Users who posted more than once are liste...

Страница 723: ...ist use the trim function to remove the space before the returned value cfset MyValue trim listGetAt myList 2 With this usage MyValue two hundred not two hundred and spaces within a list element are p...

Страница 724: ...r Username loop through the list and show it with ListGetAt h3 This list of usernames who have posted messages numbers cfoutput ListLen temp cfoutput users h3 ul cfloop From 1 To ListLen temp index Co...

Страница 725: ...a b c d has four elements Example This example shows ListInsertAt cfquery name GetParkInfo datasource cfdocexamples SELECT PARKNAME CITY STATE FROM PARKS WHERE PARKNAME LIKE DE cfquery cfset temp Val...

Страница 726: ...ove the space before the returned value cfset MyValue trim ListLast myList With this usage the MyValue variable gets the value three hundred not three hundred and spaces within a list element are pres...

Страница 727: ...ore than once are listed more than once Show the first user in the list p The first user in the list is cfoutput ListFirst temp cfoutput p The rest of the list is nbsp cfoutput ListRest temp cfoutput...

Страница 728: ...ry name GetMessageUser datasource cfdocexamples SELECT Username Subject Posted FROM Messages cfquery cfset temp ValueList GetMessageUser Username loop through the list and show it with ListGetAt h3 Th...

Страница 729: ...ListLen 729 cfoutput ListLen temp cfoutput users h3 ul cfloop From 1 TO ListLen temp INDEX Counter cfoutput li Username Counter ListGetAt temp Counter cfoutput cfloop ul...

Страница 730: ...ents thus the list a b c d has four elements If the delimiters parameter is the empty string ColdFusion returns the contents of the value parameter Example This example shows ListPrepend cfquery name...

Страница 731: ...list ColdFusion ignores empty list elements thus the list a b c d has four elements Example cfquery name GetEmployeeNames datasource cfdocexamples SELECT FirstName LastName FROM Employees cfquery h3 L...

Страница 732: ...st cfoutput show the resulting alphabetized array as a qualified list with single quotation marks around each full name cfset qualifiedList1 ListQualify myList CHAR output the array as a list cfoutput...

Страница 733: ...y name GetMessageUser datasource cfdocexamples SELECT Username Subject Posted FROM Messages cfquery cfset temp ValueList GetMessageUser Username p Before editing the list it is nbsp cfoutput ValueList...

Страница 734: ...inserts a delimiter If delimiters contains more than one delimiter ColdFusion uses the first delimiter in the string or if delimiters was omitted a comma ColdFusion ignores empty list elements thus t...

Страница 735: ...put subjects posted in messages h3 cfset ChangedElement ListGetAt temp 2 cfset TempToo ListSetAt temp 2 I changed this subject ul cfloop From 1 To ListLen temptoo INDEX Counter cfoutput li Counter SUB...

Страница 736: ...er only in case Both operations are correct The new operation ensures that an ascending and descending sort output elements in exactly reverse order For example in a textnocase desc sort of d a a b A...

Страница 737: ...contains negative and positive numbers and decimal numbers p cfset sortedNums2 ListSort 23 75 34 471 100 9745 Numeric ASC cfoutput sortedNums2 cfoutput p Here is a list to be sorted alphabetically wit...

Страница 738: ...ldFusion will break the list at either a comma or a plus sign Example h3 ListToArray Example h3 Find a list of users who wrote messages cfquery name GetMessageUser datasource cfdocexamples SELECT User...

Страница 739: ...h3 p This example uses ListValueCount to count employees in a department form action listvaluecount cfm p Select a department p select name departmentName option value Accounting Accounting OPTION opt...

Страница 740: ...me cfset myList ValueList SearchByDepartment Department cfset numberInDepartment ListValueCount myList FORM departmentName cfif numberInDepartment is 0 h3 There are no employees in cfoutput FORM depar...

Страница 741: ...ple h3 p This example uses ListValueCountNoCase to count employees in a department form action listvaluecountnocase cfm p Select a department p select name departmentName option value Accounting Accou...

Страница 742: ...partmentName cfset myList ValueList SearchByDepartment Department cfset numberInDepartment ListValueCountNoCase myList FORM departmentName cfif numberInDepartment is 0 h3 There are no employees in cfo...

Страница 743: ...aram name jstring default cfif IsDefined FORM justifyString cfset jstring LJustify FORM justifyString 35 cfif html head title LJustify Example title head body h3 LJustify Function h3 p Enter a string...

Страница 744: ...br Enter a positive real number to get its natural logarithm cfelse br The natural logarithm of FORM number log FORM number cfif cfif FORM number LTE 0 br Enter a positive real number to get its loga...

Страница 745: ...logarithm of that number cfelse br The natural logarithm of FORM number log FORM number cfif cfif FORM number LTE 0 br You must enter a positive real number to see the logarithm of that number to bas...

Страница 746: ...ed to it it returns a negative number If type local it returns the value in the current locale s standard format If type international it returns the value in the current locale s international standa...

Страница 747: ...d 100 000 00 NZD100 000 00 100 000 00 English UK 100 000 00 GBP100 000 00 100 000 00 English US 100 000 00 USD100 000 00 100 000 00 French Belgian 100 000 00 100 000 00 FB EUR100 000 00 BEF100 000 00...

Страница 748: ...dLocales index locale delimiters cfset oldlocale SetLocale locale cfoutput p b I locale I b br Local LSCurrencyFormat 100000 local br International LSCurrencyFormat 100000 international br None LSCurr...

Страница 749: ...International functions Function syntax LSDateFormat date mask See also LSParseDateTime LSTimeFormat DateFormat SetLocale Handling data in ColdFusion MX in Chapter 17 Developing Globalized Applicatio...

Страница 750: ...r LSDateFormat Now br Parameter Description date A date time object in the range 100 AD 9999 AD mask Characters that show how ColdFusion displays the date d Day of month Digits no leading zero for sin...

Страница 751: ...LSDateFormat 751 hr noshade cfoutput cfloop...

Страница 752: ...atting rules for all JVM versions as follows If the country of the current locale belongs to the Euro Zone whose members have converted to the euro the formatted output for the local type includes the...

Страница 753: ...an 100 000 00 EUR100 000 00 100 000 00 French Canadian 100 000 00 CAD100 000 00 100 000 00 French Standard 100 000 00 EUR100 000 00 100 000 00 French Swiss SFr 100 000 00 CHF100 000 00 100 000 00 Germ...

Страница 754: ...y value using the locale convention Default value is local Loop through list of locales show currency values for 100 000 units cfloop list Server Coldfusion SupportedLocales index locale delimiters cf...

Страница 755: ...belongs to the Euro Zone Parameters Usage For examples of ColdFusion code and output that shows differences between earlier ColdFusion releases and ColdFusion MX in accepting input formats and displa...

Страница 756: ...a proper currency value for cfoutput GetLocale cfoutput p Answer cfoutput LSIsCurrency FORM myValue cfoutput cfif p form action LSIsCurrency cfm p Select a locale for which you would like to check a...

Страница 757: ...le formatting rules on all platforms Changed behavior this function accepts a dash or hyphen character only in the Dutch Standard and Portuguese Standard locales If called this way for example LsIsDat...

Страница 758: ...cFOUTPUT a proper date value for cfoutput GetLocale cfoutput p Answer cfoutput LSIsDate FORM myValue cfoutput cfif p form action LSIsDate cfm p Select a locale for which you would like to check a date...

Страница 759: ...function might return a different result than in earlier releases This function uses Java standard locale formatting rules on all platforms Parameters Usage To set the default display format of date t...

Страница 760: ...X Changed behavior if the specified mask format cannot correctly mask a number this function returns the number unchanged In earlier releases it truncated the number or threw an error If no mask is sp...

Страница 761: ...s for a symbol are far left near left near right and far right The left and right positions are determined by the side of the decimal point on which the code character is shown For formats that do not...

Страница 762: ...ounding factor the conversion correctly results in a value of 1 28 If you round off a double such as 1 99499999999999999999999999999 where the last decimal is 10E 14 the rounding factor can cause an i...

Страница 763: ...uses the locale formatting rules of the JVM specified in the ColdFusion Administrator Java and JVM page on all platforms These rules changed between Sun JVM 1 3 1 and JVM 1 4 1 JVM 1 3 1 requires tha...

Страница 764: ...456 units cfloop LIST Server Coldfusion SupportedLocales index locale delimiters cfset oldlocale SetLocale locale cfoutput p B I locale I B br Local LSCurrencyFormat 123456 78 local br Parsed local C...

Страница 765: ...standard locale formatting rules on all platforms Changed how the date time string parameter value is processed ColdFusion processes the date time string parameter value time zone information differen...

Страница 766: ...eTime Example returns a locale specific date time object h3 loop through a list of locales and show date values for Now cfloop LIST Server Coldfusion SupportedLocales index locale delimiters cfset old...

Страница 767: ...tries in the Euro currency zone Parameters Usage This function determines whether the current locale s country belongs to the Euro Zone whose members have converted to the euro if so the currency stri...

Страница 768: ...arseEuroCurrency localCurrency br cfset IntlCurrency LSEuroCurrencyFormat 123456 international Value with International currency formatting IntlCurrency br Parsed using LSParseEuroCurrency LSParseEuro...

Страница 769: ...Usage This function uses Java standard locale formatting rules on all platforms To set the default display format of date time number and currency values use the SetLocale function Example h3 LSParse...

Страница 770: ...ter 3 ColdFusion Functions LSNumberFormat 1234 5678 _________ ___ br LSNumberFormat 1234 5678 _________ ___ br The actual number LSParseNumber LSNumberFormat 1234 5678 _________ br hr noshade cfoutput...

Страница 771: ...sk See also LSParseDateTime LSDateFormat TimeFormat Locales in Chapter 17 Developing Globalized Applications in ColdFusion MX Developer s Guide History ColdFusion MX 6 1 Added the mask character L or...

Страница 772: ...ldlocale SetLocale locale Parameter Description string A date time value A string that is convertible to a time value A date time object is in the range 100 AD 9999 AD mask Masking characters that det...

Страница 773: ...Format 773 cfoutput p B I locale I B br LSTimeFormat Now br LSTimeFormat Now hh mm ss br LSTimeFormat Now hh mm sst br LSTimeFormat Now hh mm sstt br LSTimeFormat Now HH mm ss br hr noshade cfoutput c...

Страница 774: ...so RTrim ToBase64 Parameters Example h3 LTrim Example h3 cfif IsDefined FORM myText cfoutput pre Your string FORM myText Your string LTrim FORM myText left trimmed pre cfoutput cfif form action ltrim...

Страница 775: ...meric FORM myNum2 p The maximum of the two numbers is cfoutput Max FORM myNum1 FORM myNum2 cfoutput p The minimum of the two numbers is cfoutput Min FORM myNum1 FORM myNum2 cfoutput cfelse p Please en...

Страница 776: ...myText cfoutput p style color red font weight bold Your string Form myText only has Len Form myText characters You cannot start at position Form startPos p cfoutput cfelse cfoutput p Your original st...

Страница 777: ...ter a starting position from the beginning of the entered text br input name startPos type text size 1 p p How many characters do you want to show select name RemoveChars option value 1 1 option value...

Страница 778: ...IsNumeric FORM myNum2 p The maximum of the two numbers is cfoutput Max FORM myNum1 FORM myNum2 cfoutput p The minimum of the two numbers is cfoutput Min FORM myNum1 FORM myNum2 cfoutput cfelse p Plea...

Страница 779: ...sh Second Parameters Usage When passing a date time value as a string you must enclose it in quotation marks Otherwise it is interpreted as a number representation of a date time object Example h3 Min...

Страница 780: ...the date parameter of this function for example Month CreateDate 2001 3 3 Example h3 Month Example h3 cfif IsDefined FORM year More information about your date cfset yourDate CreateDate FORM year FOR...

Страница 781: ...ore information about your date cfset yourDate CreateDate FORM year FORM month FORM day cfoutput p Your date DateFormat yourDate br It is DayofWeekAsString DayOfWeek yourDate day DayOfWeek yourDate in...

Страница 782: ...OfMonth Returns A date time object the current date and time of the computer running the ColdFusion server Category Date and time functions Function syntax Now See also CreateDateTime DatePart Example...

Страница 783: ...d It does not truncate the number nor throw an error If no mask is selected ColdFusion MX rounds the decimal part as ColdFusion 5 does For example it rounds 34 567 to 35 Parameters The following table...

Страница 784: ...umbers The positions for a symbol are far left near left near right and far right The left and right positions are determined by the side of the decimal point on which the code character is shown For...

Страница 785: ...a double such as 1 99499999999999999999999999999 where the last decimal is 10E 14 the rounding factor can cause an incorrect result To set the default display format of date time number and currency v...

Страница 786: ...elds Example h3 ParagraphFormat Example h3 p Enter text into this textarea and see it returned as HTML cfif IsDefined FORM myTextArea p Your text area formatted p cfoutput ParagraphFormat FORM myTextA...

Страница 787: ...on This function is deprecated Use the IsDefined function Determines whether a parameter exists ColdFusion does not evaluate the argument History ColdFusion MX Deprecated this function It might not wo...

Страница 788: ...nfo function To set the default display format of date time number and currency values use the SetLocale function Example h3 ParseDateTime Example h3 cfif IsDefined form theTestValue cfif IsDate form...

Страница 789: ...ot a valid date h3 cfif cfif form action CGI ScriptName method POST p Enter an expression and discover if it can be evaluated to a date value input type Text name TheTestValue value CFOUTPUT DateForma...

Страница 790: ...79 Category Mathematical functions Function syntax Pi See also ASin Cos Sin Tan Example h3 Pi Example h3 By default ColdFusion displays only 11 significant digits Use NumberFormat to display all 15 Th...

Страница 791: ...useful in SQL statements to defer evaluation of a variable reference until runtime This prevents errors that result from the evaluation of a single quote or apostrophe data character for example Joe...

Страница 792: ...is example we pick the list of Centers in Suisun San Francisco and San Diego using the SQL grammar IN to modify a WHERE clause rather than looping through the result set after the query is run cfset L...

Страница 793: ...so DatePart Month Parameters Usage When passing a date time value as a string you must enclose it in quotation marks Otherwise it is interpreted as a number representation of a date time object Exampl...

Страница 794: ...if a user attempts to add a column whose name is invalid ColdFusion throws an error In earlier releases ColdFusion permitted the add operation but the user could not reference the column after adding...

Страница 795: ...shorter than the third QueryAddColumn adds padding to the corresponding columns in the query Make a query cfset myQuery QueryNew Create an array cfset FastFoodArray ArrayNew 1 cfset FastFoodArray 1 F...

Страница 796: ...796 Chapter 3 ColdFusion Functions th align left Health Food th tr cfoutput query myQuery tr td FastFood td td FineCuisine td td HealthFood td tr cfoutput table...

Страница 797: ...ELECT Course_ID Descript FROM Courses cfquery p The Query GetCourses has cfoutput GetCourses RecordCount cfoutput rows cfset CountVar 0 cfloop CONDITION CountVar LT 15 cfset temp QueryAddRow GetCourse...

Страница 798: ...ypelist parameter Without this parameter ColdFusion must try to determine data types when it uses the query object in a query of queries Determining data types requires additional processing and can r...

Страница 799: ...the query cfset temp QuerySetCell myQuery Name The Wonderful World of CMFL 1 cfset temp QuerySetCell myQuery Time 9 15 AM 1 cfset temp QuerySetCell myQuery Advanced False 1 cfset temp QuerySetCell my...

Страница 800: ...ource cfdocexamples SELECT Course_ID Descript FROM Courses cfquery p The Query GetCourses has cfoutput GetCourses RecordCount cfoutput rows cfset CountVar 0 cfloop CONDITION CountVar LT 15 cfset temp...

Страница 801: ...cfquery name GetDepartments datasource cfdocexamples SELECT Dept_ID FROM Departments WHERE Dept_ID IN PreserveSingleQuotes List cfquery now select the courses for that department based on the quotedVa...

Страница 802: ...rity provider This provider includes the algorithms listed in the Parameters section except the default algorithm The JCE framework includes facilities for using other provider implementations however...

Страница 803: ...talls a Sun Java 1 4 2 runtime that includes the Sun JCE default security provider This provider includes the algorithms listed in the Parameters section except the default algorithm The JCE framework...

Страница 804: ...eric FORM myRandomInt cfoutput b Seed value is FORM myRandomInt b br cfoutput br Call Randomize to seed the random number generator cfset r Randomize FORM myRandomInt SHA1PRNG cfoutput b Random number...

Страница 805: ...he Sun JCE default security provider This provider includes the algorithms listed in the Parameters section except the default algorithm The JCE framework includes facilities for using other provider...

Страница 806: ...mySeed b br cfoutput br Call Randomize to seed the random number generator cfset r Randomize FORM mySeed SHA1PRNG cfelse b No Seed value submitted b br cfif Generate and display the random number cfo...

Страница 807: ...If the regular expression is found in the string the first element of the len and pos arrays contains the length and position respectively of the first match of the entire regular expression If the r...

Страница 808: ...u 5 cfoutput p Set startPos to one returnMatchedSubexpressions TRUE hr size 2 color 0000A0 p If you use the i returnssubexpression i parameter REFind returns the position and length of the first occu...

Страница 809: ...A0 p However if you use parentheses in the regular expression the first element contains the position and length of the first instance of the whole expression The position and length of the first inst...

Страница 810: ...is found in the string the first element of the len and pos arrays contains the length and position respectively of the first match of the entire regular expression If the regular expression contains...

Страница 811: ...ndNoCase rep report cfm rep 1234 u 5 cfoutput p Set startPos to one returnMatchedSubexpressions True hr size 2 color 0000A0 p If you do use the i returnssubexpression i parameter REFindNoCase returns...

Страница 812: ...t p hr size 2 color 0000A0 p However if you use parentheses to denote subexpressions in the regular expression the first element contains the position and length of the first instance of the whole exp...

Страница 813: ...as a quit method that terminates the program call this method before you call the ReleaseComObject function This function can improve processing efficiency but is not required for an application to wo...

Страница 814: ...0 if no characters are found cfif IsDefined FORM myString cfif FORM numChars FORM start GT Len FORM myString p Your string is only cfoutput Len FORM myString cfoutput characters long Please enter a lo...

Страница 815: ...3 p RepeatString returns a string created from I string I repeated a specified number of times ul li RepeatString 10 cfoutput RepeatString 10 cfoutput li RepeatString lt BR gt 3 cfoutput RepeatString...

Страница 816: ...zy cow dog and cat All Example h3 Replace Example h3 p The Replace function returns I string I with I substring1 I replaced by I substring2 I in the specified scope This is a case sensitive search cfi...

Страница 817: ...ed scope cfif IsDefined FORM MyString p Your original string cfoutput FORM MyString cfoutput p You wanted to replace the substring cfoutput FORM MySubstring1 cfoutput with the substring cfoutput FORM...

Страница 818: ...r 3 ColdFusion Functions h3 Replacelist Example Two h3 cfset stringtoreplace The quick brown fox jumped over the lazy dog cfoutput ReplaceList stringtoreplace dog brown fox black cow black ferret whit...

Страница 819: ...the specified scope The search replace is case insensitive cfif IsDefined FORM MyString p Your original string cfoutput FORM MyString cfoutput p You wanted to replace the substring cfoutput FORM MySub...

Страница 820: ...ring functions Function syntax REReplace string reg_expression substring scope See also REFind Replace ReplaceList REReplaceNoCase History ColdFusion MX Added supports for the following special codes...

Страница 821: ...ced with i substring i in the specified scope Case sensitive search p REReplace CABARET C B G ALL cfoutput REReplace CABARET C B G ALL cfoutput p REReplace CABARET A Z G ALL cfoutput REReplace CABARET...

Страница 822: ...cement strings to control case conversion u U l L and E If any of these strings is present in a ColdFusion 5 application you must insert a backslash before it for example change u to u Parameters Usag...

Страница 823: ...A Z G ALL cfoutput REReplaceNoCase cabaret A Z G ALL cfoutput p REReplaceNoCase I LOVE JELLIES jell y ies cookies cfoutput REReplaceNoCase I LOVE JELLIES jell y ies cookies cfoutput p REReplaceNoCase...

Страница 824: ...as the following cfoutput reverse 6 2 equals reverse 6 2 cfoutput This code outputs the following reverse 6 2 equals 21 Example h3 Reverse Example h3 p Reverse returns your string with the positions...

Страница 825: ...ump over the fence 9 br Right ColdFusion 6 cfoutput Right Example using form input h3 Right Example h3 cfif IsDefined Form MyText If len returns 0 zero then show error message cfif Len FORM myText cfi...

Страница 826: ...f form action cfoutput CGI ScriptName cfoutput method POST p Type in some text br input type Text name myText p p How many characters from the right do you want to show select name RemoveChars option...

Страница 827: ...Defined FORM justifyString cfset jstring rjustify FORM justifyString 35 cfif html head title RJustify Example title head body h3 RJustify Function h3 p Enter a string It will be right justified within...

Страница 828: ...rounds numbers that end with 5 up to the nearest integer It rounds 3 5 to 4 and 3 5 to 3 Example h3 Round Example h3 p This function rounds a number to the closest integer ul li Round 7 49 cfoutput R...

Страница 829: ...Example h3 RTrim Example h3 cfif IsDefined FORM myText cfoutput pre Your string FORM myText Your string RTrim FORM myText right trimmed pre cfoutput cfif form action Rtrim cfm method post p Enter som...

Страница 830: ...ute Parameters Usage When passing a date time object as a string you must enclose it in quotation marks Otherwise it is interpreted as a number representation of a date time object Example This exampl...

Страница 831: ...outgoingMessage method The value returned by the function depends on the gateway type The following table describes the return values for standard ColdFusion MX gateway types Parameter Description ga...

Страница 832: ...e ColdFusion MX Administrator as Asynch Logger br cfscript status false props structNew props message Replace me with a variable with data to log status SendGatewayMessage Asynch Logger props if statu...

Страница 833: ...tEncoding scope_name charset See also GetEncoding cfcontent cfprocessingdirective URLDecode URLEncodedFormat Locales in Chapter 17 Developing Globalized Applications in ColdFusion MX Developer s Guide...

Страница 834: ...tl encoding doc html lists the character encoding that Java 1 4 1 and therefore the default ColdFusion configuration can interpret If you use a JVM that does not conform to the Sun Java 2 Platform Sta...

Страница 835: ...This function uses Java standard locale determination and formatting rules on all platforms Deprecated the Spanish Mexican locale option It might not work and it might cause an error in later release...

Страница 836: ...locale setting you can save the original locale value You can restore the original locale by calling SetLocale again with the saved variable For example the following line saves the original locale i...

Страница 837: ...the form was submitted If so this section sets the initialization path and timeout value to the path and timeout value specified in the form cfif Isdefined Form Submit cfset IniPath FORM iniPath cfset...

Страница 838: ...on timeout cfset default GetProfileString IniPath Section default h4 Boot Loader h4 p Timeout is set to cfoutput timeout cfoutput p p Default directory is cfoutput default cfoutput p cfif form action...

Страница 839: ...e in quotation marks and number signs for example cfset DynamicVar2 ABD cfset DynamicVar2 Test Value2 Also the following lines are equivalent cfset myVar i myVal SetVariable myVar i myVal For more inf...

Страница 840: ...840 Chapter 3 ColdFusion Functions cfset varNameValue Evaluate myName cfoutput p Your variable varName p The value of varName is varNameValue cfoutput cfif...

Страница 841: ...functions Function syntax Sgn number See also Abs Parameters Example h3 Sgn Example h3 p Sgn determines the sign of a number Returns 1 if number is positive 0 if number is 0 1 if number is negative p...

Страница 842: ...should produce 0 To test for a 0 value check whether the value is less than 0 0000000000001 Example h3 Sin Example h3 Calculate sine if form has been submitted cfif IsDefined FORM sinNum Make sure inp...

Страница 843: ...Sin 843 cfif cfif form action CGI script_name method post Enter an angle in degrees to get its sine br input type Text name sinNum size 15 br br input type Submit name nbsp nbsp input type RESET form...

Страница 844: ...ing Example h3 cfif IsDefined FORM myString p Your string was cfoutput FORM myString cfoutput p Your set of characters was cfoutput FORM mySet cfoutput p Your string up until one of the characters in...

Страница 845: ...f IsDefined FORM myString p Your string was cfoutput FORM myString cfoutput p Your set of characters was cfoutput FORM mySet cfoutput p Your string until the characters in the set have been found is c...

Страница 846: ...See also Abs Parameters Usage The value in number must be greater than or equal to 0 Example h3 Sqr Example h3 p Returns the square root of a positive number p Sqr 2 cfoutput Sqr 2 cfoutput p Sqr Abs...

Страница 847: ...ction StripCR is useful for preformatted HTML display of data PRE entered in textarea fields cfif isdefined Form myTextArea pre cfoutput StripCR Form myTextArea cfoutput pre cfif use Chr 10 Chr 13 to...

Страница 848: ...2 to struct1 struct2 is not modified If struct1 already contains a field of struct2 overwriteFlag determines whether the value in struct2 overwrites it A structure s keys are unordered Example html bo...

Страница 849: ...struct before the Append p The person struct b before b the Append call br cfloop collection personCLK item myItem cfoutput myItem br cfoutput cfloop Merge the address struct into the top level perso...

Страница 850: ...Note 14143 ColdFusion 4 5 and the StructClear Session function at www coldfusion com Support KnowledgeBase SearchForm cfm The article applies to ColdFusion 4 5 5 x and ColdFusion MX Example Shows Stru...

Страница 851: ...StructInsert employee email Form email StructInsert employee phone Form phone StructInsert employee department Form department cfscript cfoutput Call the custom tag that adds employees cf_addemployee...

Страница 852: ...ide Parameters Usage The following code shows how this function copies a structure that contains a string field a number field and a two dimensional array at the top level cfoutput cfset assignedCopy...

Страница 853: ...cript Output original structure hr b Original Values b br cfoutput Simple values br s number s number br s string s string br Array value br s array 1 1 s array 1 1 br s array 1 2 s array 1 2 br cfout...

Страница 854: ...t Create elements s StructNew s nested StructNew s nested array ArrayNew 2 Assign simple values to nested structure fields s nested number 99 s nested string hello tommy Assign values to nested array...

Страница 855: ...should reflect changes to original b br cfoutput Simple values br copied nested number copied nested number br copied nested string copied nested string br Array values br copied nested array 1 1 copi...

Страница 856: ...ilar to addemployee cfm which is called by StructNew StructClear and StructDelete To test copy StructCount function to appropriate place in addemployee cfm cfswitch expression ThisTag ExecutionMode cf...

Страница 857: ...StructCount 857 cfquery cfif cfoutput hr Employee Add Complete p StructCount attributes EMPINFO columns added cfoutput cfcase cfswitch...

Страница 858: ...k p This example uses the StructInsert and StructDelete functions Establish params for first time through cfparam name firstname default Mary cfparam name lastname default Sante cfparam name email def...

Страница 859: ...rm field The code indicates rc br The structure now looks like this br cfdump var employee br cfoutput cfif br br form method post action CGI Script_Name p Select the field to be deleted nbsp select n...

Страница 860: ...ructNew StructClear and StructDelete It adds employees Employee information is passed through the employee structure EMPINFO attribute In UNIX you must also add the Emp_ID cfswitch expression ThisTag...

Страница 861: ...StructFind 861 cfquery cfif cfoutput hr Employee Add Complete cfoutput cfcase cfswitch...

Страница 862: ...n MX Developer s Guide Parameters Usage Returns an array that includes one structure for each of the specified values it finds The fields of each of these structures are Value value held in the found...

Страница 863: ...dFusion MX Developer s Guide Parameters Usage The fields of each structure in the returned array are Key name of the key in which the value was found Path string which could be used to reach the found...

Страница 864: ...tructure or array present in pathDesired this function creates structures or arrays to make pathDesired a valid variable path Parameters Usage You can inadvertently create invalid structures using thi...

Страница 865: ...defined br cfif cfoutput dog myscope test foo br cfoutput cfset test StructGet request myscope 1 test cfset test foo 2 cfoutput request myscope 1 test foo br cfoutput cfset test StructGet request mys...

Страница 866: ...ior this function can be used on XML objects Parameters Usage A structure s keys are unordered Example h1 Add New Employees h1 Establish params for first time through cfparam name FORM firstname defau...

Страница 867: ...loyee phone p p Department is StructFind employee department p cfoutput Call the custom tag that adds employees CF_ADDEMPLOYEE EMPINFO employee cfif Hr form action structinsert cfm p First Name nbsp i...

Страница 868: ...ee cfm which is called by StructNew StructClear and StructDelete It adds employees Employee information is passed through employee structure EMPINFO attribute In UNIX you must also add the Emp_ID cfsw...

Страница 869: ...StructIsEmpty 869 cfoutput cfquery cfif cfoutput hr Employee Add Complete cfoutput cfcase cfswitch...

Страница 870: ...xtracting the Keys from the Employee Structure h3 Create structure Check whether Submit was pressed If so define fields in employee structure with user entries on form cfset employee StructNew cfif Is...

Страница 871: ...h 30 td tr tr td Phone td td input name phone type text value hspace 20 maxlength 20 td tr tr td Company td td input name company type text value hspace 30 maxlength 30 td tr tr td input type submit n...

Страница 872: ...StructKeyExists Form JediMaster A structure s keys are unordered Example This example shows the use of StructKeyExists p This file is similar to addemployee cfm which is called by StructNew StructClea...

Страница 873: ...and fills it with information user enters in form fields This section creates structure and checks whether Submit has been pressed If so code defines fields in the employee structure with what the us...

Страница 874: ...rst Name td td input name firstname type text value hspace 30 maxlength 30 td tr tr td Last Name td td input name lastname type text value hspace 30 maxlength 30 td tr tr td EMail td td input name ema...

Страница 875: ...email default cfparam name FORM phone default cfparam name FORM department default cfif FORM firstname EQ p Please fill out the form cfelse cfoutput cfscript employee StructNew StructInsert employee f...

Страница 876: ...t string does not support array notation and only supports substructures of structures This function does not sort or change the structure Example cfscript salaries StructNew employees StructNew depar...

Страница 877: ...ries numeric ASC br 6 ArrayToList StructSort salaries numeric DESC br p list of employees based on the salary subfield search br 7 ArrayToList StructSort employees numeric DESC salary br 8 ArrayToList...

Страница 878: ...ee cfm which is called by StructNew StructClear and StructDelete To test this file copy the LT CFELSEIF GT statement to the appropriate place in addemployee cfm It is an example of a custom tag used t...

Страница 879: ...To test for a 0 value check whether the value is less than 0 0000000000001 To test for an infinite value check whether the value is more than 1E15 Example h3 Tan Example h3 Calculate tangent if form h...

Страница 880: ...oldFusion Functions cfif cfif form action CGI script_name method post Enter an angle in degrees to get its tangent br input type Text name tanNum size 15 br br input type Submit name nbsp nbsp input t...

Страница 881: ...Fusion MX Changed the way extra characters are processed this function processes extra characters within the mask value differently than in earlier releases as follows ColdFusion 5 and earlier the fun...

Страница 882: ...utput ul li TimeFormat todayDate li TimeFormat todayDate hh mm ss li TimeFormat todayDate hh mm sst li TimeFormat todayDate hh mm sstt li TimeFormat todayDate HH mm ss ul cfoutput p To generate a stan...

Страница 883: ...TimeFormat 883 TimeFormat function For example dateformat now yyyy mm dd T TimeFormat now HH mm ss produces p cfoutput dateformat now yyyy mm dd T TimeFormat now HH mm ss cfoutput body...

Страница 884: ...ormation about serializing and deserializing binary data IsBinary and ToBinary for checking for binary data and converting a Base64 object to binary format History ColdFusion MX Added the encoding par...

Страница 885: ...charData charData ch cfloop p The following string is the concatenation of all characters 32 to 255 from the ASCII table br cfoutput charData cfoutput p Create a Base64 representation of this string...

Страница 886: ...ary data type and binary encoding in Chapter 3 Using ColdFusion Variables in ColdFusion MX Developer s Guide Parameters Usage Macromedia recommends that you use the BinaryDecode function to convert Ba...

Страница 887: ...binary back to Base64 cfset another64 toBase64 binaryData Compare another64 with data64 to ensure that they are equal cfif another64 eq data64 h3 Base64 representation of binary data is identical to...

Страница 888: ...s Parameter Description cfvar A ColdFusion variable This can contain one of the following String Number Array Structure Query javascriptvar A string that specifies the name of the JavaScript variable...

Страница 889: ...a column name and the value of the recordlist entry is an array of the corresponding query column entries as follows WDDXQuery new WddxRecordset col0 new Array col0 0 John col0 1 John WDDXQuery first...

Страница 890: ...his is a string cfoutput b The thisString variable in ColdFusion b br thisString br br strong The output of ToScript thisString jsVar strong br ToScript thisString jsVar br br strong In a JavaScript s...

Страница 891: ...align left width 9 header b FirstName b text FirstName cfcol align left width 9 header b LastName b text LastName cftable strong JavaScript generated by ToScript thisQuery WDDXQuery strong br toScrip...

Страница 892: ...See also ToBase64 ToBinary CharsetEncode Chapter 35 Using XML and WDDX in ColdFusion MX Developer s Guide History ColdFusion MX Changed Unicode support ColdFusion supports the Java UCS 2 representatio...

Страница 893: ...cfoutput charData cfoutput p Create a Base64 representation of this string cfset data64 toBase64 charData p The following string is the Base64 representation of the string br cfoutput data64 cfoutput...

Страница 894: ...nctions cfset dataBinary toBinary data64 Create the string representation of the binary data cfset dataString ToString dataBinary p The following is the string representation of the binary data br cfo...

Страница 895: ...ample h3 Trim Example h3 cfif IsDefined FORM myText cfoutput pre Your string FORM myText Your string Trim FORM myText trimmed on both sides pre cfoutput cfif form method post action trim cfm p Type in...

Страница 896: ...cfif IsDefined FORM sampleText cfif FORM sampleText is not p Your text cfoutput FORM sampleText cfoutput returned in uppercase is cfoutput UCase FORM sampleText cfoutput cfelse p Please enter some tex...

Страница 897: ...ColdFusion MX Changed Unicode support ColdFusion supports the Java UCS 2 representation of Unicode character values 0 65535 Earlier releases supported ASCII values Added the charset parameter Paramete...

Страница 898: ...y strings in HTTP are always URL encoded Example This example creates encodes and decodes a string that contains ASCII character codes cfscript Build string s for c 1 c lte 256 c c 1 s s chr c Encode...

Страница 899: ...ns for globalizing in Chapter 17 Developing Globalized Applications in ColdFusion MX Developer s Guide History ColdFusion MX 6 1 Changed the default encoding to be the response character encoding Cold...

Страница 900: ...a plus sign Query strings in HTTP are always URL encoded Example h3 URLEncodedFormat Example h3 cfif IsDefined url myExample p The url variable url myExample was passed from the previous link its valu...

Страница 901: ...r to code Returns A URL if cookies are disabled for the browser client and session data are appended Category Other functions Chapter 15 Maintaining client identity in Chapter 15 Using Persistent Data...

Страница 902: ...ue 0 not an error If TestValue 0 Val TestValue returns the value 0 not an error Example h3 Val Example h3 cfif IsDefined FORM theTestValue cfif Val FORM theTestValue is not 0 h3 The string cfoutput DE...

Страница 903: ...Val 903 value Is the beginning numeric name form...

Страница 904: ...e GetDepartments datasource cfdocexamples SELECT Dept_ID FROM Departments WHERE Dept_ID IN BIOL cfquery cfquery name GetCourseList datasource cfdocexamples SELECT FROM CourseList WHERE Dept_ID IN GetD...

Страница 905: ...cfif IsDefined FORM year More information about your date cfset yourDate CreateDate FORM year FORM month FORM day cfoutput p Your date DateFormat yourDate br It is DayOfWeekAsString DayOfWeek yourDate...

Страница 906: ...d newline on Windows If you specify the strip parameter all existing line breaks are removed so any paragraph formatting is lost Use this function to limit the length of text lines such as text to be...

Страница 907: ...the current SQL statement or mail text Do not use WriteOutput within cfquery and cfmail Although you can call this function anywhere within a page it is most useful inside a cfscript block Example cfs...

Страница 908: ...functions to change XML document objects If the specified child is not found the function returns 1 Example The following example searches XML document element xmlobject employee name 1 for its secon...

Страница 909: ...nd the second Status child of the first employee name element cfscript elempos XMLChildPos xmlobject employee name 1 Status 2 ArrayDeleteAt xmlobject employee name 1 XmlChildren elempos cfscript Dump...

Страница 910: ...by the xmlObj parameter The following statements show this use MyDoc MyRoot XmlChildren 2 XmlElemNew MyDoc childNode ArrayAppend MyDoc MyRoot XmlChildren XmlElemNew MyDoc childNode If you do not spec...

Страница 911: ...else MyDoc MyRoot XmlText The value of testVar is False for i 1 i LTE 4 i i 1 MyDoc MyRoot XmlChildren i XmlElemNew MyDoc childNode MyDoc MyRoot XmlChildren i XmlText This is Child node i cfscript cf...

Страница 912: ...llowing example shows how XmlFormat escapes special XML characters Use the View Source command in the browser to see the results ColdFusion interprets the in the second text string as representing a s...

Страница 913: ...XmlFormat 913 someXML someElement someAttribute XmlFormat a quoted value XmlFormat Body of element with and goes here someElement someXML cfoutput...

Страница 914: ...Added this function Parameters Usage The XmlGetNodeType function can determine the types of the nodes returned by the XmlSearch function or the types of the entries in an element s XmlNodes array Exa...

Страница 915: ...GetNodeType xmlobject order br br Now check the types of all the nodes in the xmlobject order items item element s XmlNodes array br Note the many apparently empty Text nodes generated by whitespace c...

Страница 916: ...nd NAME refer to different elements or attributes If False these names refer to the same elements or attributes If your XML object is case sensitive you cannot use dot notation to reference an element...

Страница 917: ...mlNew MyDoc xmlRoot XmlElemNew MyDoc MyRoot if testVar IS TRUE MyDoc MyRoot XmlText The value of testVar is True else MyDoc MyRoot XmlText The value of testVar is False for i 1 i LTE 4 i i 1 MyDoc MyR...

Страница 918: ...specify a relative URL or path name in a parameter ColdFusion uses the directory or for URLs the logical directory that contains the current ColdFusion page as the path root Parameter Description xmlT...

Страница 919: ...se function validate your document If you do not specify a validator parameter and the XML file specifies a DTD or Schema ColdFusion ignores the DTD or Schema If you specify a validator parameter you...

Страница 920: ...CDATA REQUIRED accountNum CDATA REQUIRED ELEMENT items item ELEMENT item name quantity unitprice ATTLIST item id CDATA REQUIRED ELEMENT name PCDATA ELEMENT quantity PCDATA ELEMENT unitprice PCDATA Th...

Страница 921: ...orts XPath expressions that return one or more XML nodes and attribute searches XPath expressions that return any other type of value such as a string number or Boolean generate errors XPath is specif...

Страница 922: ...ast name employee The CFML file contains the following lines cfscript myxmldoc XmlParse C CFusionMX7 wwwroot examples employeesimple xml selectedElements XmlSearch myxmldoc employee name last for i 1...

Страница 923: ...plying an Extensible Stylesheet Language XSL stylesheet to it XSL including XSLT syntax is specified by the World Wide Web Consortium W3C For detailed information on XSL and XSLT see the W3C website a...

Страница 924: ...tem id 43 name Deluxe Carpenter apos s Hammer name quantity 1 quantity unitprice 15 95 unitprice item item id 54 name 36 quot Plastic Rake name quantity 2 quantity unitprice 6 95 unitprice item item i...

Страница 925: ...mplate xsl stylesheet The CFML file has the following lines cffile action read file C CFusionMX7 wwwroot examples custorder xsl variable xmltrans cfset xmldoc XmlParse C CFusionMX7 wwwroot examples cu...

Страница 926: ...is not valid FatalErrors An array containing any validator fatal error messages Fatal errors indicate that the document contains XML formatting errors is not well formed XML Status A Boolean value Tr...

Страница 927: ...processing As a result the returned structure can have a combination of Warning Error and FatalError fields and each field can contain multiple error messages Example The following example has three...

Страница 928: ...m xs complexType xs sequence xs element ref name xs element ref quantity xs element ref unitprice xs sequence xs attribute name id type xs integer use required xs attribute xs complexType xs element x...

Страница 929: ...XmlValidate 929 Did custorder xml validate against custorder xsd results status br br cfoutput Dump of myResults structure returned by XMLValidate br cfdump var myResults...

Страница 930: ...FORM year More information about your date cfset yourDate CreateDate FORM year FORM month FORM day cfoutput p Your date DateFormat yourDate br It is DayOfWeekAsString DayOfWeek yourDate day DayOfWeek...

Страница 931: ...oFormat value See also IsBinary IsNumeric Parameters Example h3 YesNoFormat Example h3 p The YesNoFormat function returns non zero values as Yes zero false and no Boolean values and empty strings as N...

Страница 932: ...932 Chapter 3 ColdFusion Functions...

Страница 933: ...cfformgroup with tabnavigator type attribute 939 Styles for cfformitem with hrule or vrule type attributes 939 Styles for cfinput with radioButton checkbox button image or submit type attributes 940 S...

Страница 934: ...color of components when disabled The default value is EFEEEF light gray backgroundSize N Scales the image specified by backgroundImage to different percentage sizes By default the value is auto which...

Страница 935: ...bold Recognized values are normal and bold The default value is normal highlightColor Y Format color color of the control when it is in focus horizontalGap N Format length number of pixels between chi...

Страница 936: ...marginBottom N Format length number of pixels between the container s bottom border and its content area The default value is 16 marginTop N Format length number of pixels between the container s top...

Страница 937: ...t of children in the container The default value is left Possible values are left center and right horizontalGap N Format length number of pixels between children in the horizontal direction The defau...

Страница 938: ...t of two colors used to draw the header The first color is the top color The second color is the bottom color The default value is E1E5EB F4F5F7 headerHeight N Format length height of the header The d...

Страница 939: ...a size larger than its preferred width to see different alignments horizontalGap N Format length number of pixels between children in the horizontal direction The default value is 6 tabHeight N Format...

Страница 940: ...er than 2 the rule is a hollow rectangle with 1 pixel wide edges The default value is 2 Style Inh Description borderThickness N Thickness of border ring A value of 0 means no border Any value greater...

Страница 941: ...84 dark gray texRollOverColor Y Format color text color of the label as you move the mouse pointer over the control The default value is 2B333C textSelectColor Y Format color text color of the label a...

Страница 942: ...round when the user moves the mouse pointer over the link The default value is 0EFFD6 selectionColor Y Format color color of the background when the user selects the link The default value is 0DFFC1 s...

Страница 943: ...The default value is 8 Style Inh Description alternatingRowColors Y Type Array colors for rows in an alternating pattern Value can be an Array of two or more colors depthColors Y Type Array array of...

Страница 944: ...944 Chapter 4 ColdFusion MX Flash Form Style Reference...

Страница 945: ...ia recommends that you always start the Application cfc filename with an uppoercase A Both application cfc and Application cfc are reserved words Note If your application has an Application cfc and an...

Страница 946: ...e stored can be cookie registry or the name of a data source loginStorage cookie Whether to store login information in the Cookie scope or the Session scope sessionManagement no Whether the applicatio...

Страница 947: ...ollowing order 1 onApplicationStart if not run before for this application 2 onSessionStart if not run before for this session 3 onRequestStart 4 onRequest 5 onRequestEnd The onApplicationEnd onSessio...

Страница 948: ...not associated with a request The application ends even if this method throws an exception If you call this method explicitly ColdFusion does not end the application it does execute the method code b...

Страница 949: ...ou normally do for example as Application myVariable This method can access the requested page s Variables scope only if the Application cfc file includes an onRequest method that calls the page If yo...

Страница 950: ...ailable message cfcatch message Detail cfcatch detail Native Error cfcatch NativeErrorCode cfreturn False cfcatch cftry cflog file This Name type Information text Application Started You do not have t...

Страница 951: ...f an error occurs during an onApplicationStart onSessionStart onRequestStart onRequest or onRequestEnd event method or while processing a request The onError method cannot display output to the user i...

Страница 952: ...ues for the remaining errors Example cffunction name onError cfargument name Exception required true cfargument type String name EventName required true Log all errors cflog file This Name type error...

Страница 953: ...behavior of running the requested pages The following rules specify where and how you use the onRequest method Implement this method only if the following are true The directory and any subdirectories...

Страница 954: ...also implement the onRequestStart and onRequestEnd methods You can use this method to do preprocessing that is required for all requests Typical uses include filtering and modifying request page conte...

Страница 955: ...page context and can generate output This method can be useful for gathering performance metrics or for displaying dynamic footer information This method can access the requested page s Variables scop...

Страница 956: ...ank you for shopping at our store theAuthUser h3 cfoutput A very simple noauthuserfooter cfm page consists of the following code cfoutput h3 Remember only registered users get all our benefits h3 cfou...

Страница 957: ...uses the cfthrow tag ColdFusion handles the error and does not process the request further If you call this method explicitly ColdFusion does not start a request but does execute the method code This...

Страница 958: ...those hours tell people to come back later and do not process the request further cfscript if Hour now gt 1 and Hour now lt 3 WriteOutput The system is undergoing periodic maintenance Please return af...

Страница 959: ...u can for example save session related data such as shopping cart contents or whether the user has not completed an order in a database or do any other required processing based on the user s status Y...

Страница 960: ...ethod is not called when an application ends The onSessionEnd does not execute if there is no active application however Example The following method decrements an Application scope session count vari...

Страница 961: ...the Session scope to set its variables using this method If you call this method explicitly ColdFusion does not start a session it does execute the method code but does not lock the Session scope Thi...

Страница 962: ...962 Chapter 5 Application CFC Reference...

Страница 963: ...structure and commands 1042 CFML event gateway SendGatewayMessage data parameter 1052 Note The following CFML functions also apply to gateway application development GetGatewayHelper SendGatewayMessa...

Страница 964: ...elper getHelper Returns an instance of the GatewayHelper class for this gateway type instance or null if the gateway does not have a GatewayHelper class int getStatus Gets the event gateway status Str...

Страница 965: ...e single parameter version ColdFusion always uses the setGatewayID method to set the ID Example The following example shows the two argument constructor implemented in the ColdFusion MX SocketGateway...

Страница 966: ...ng getGatewayID See also setGatewayID Providing Gateway class service and information routines in Chapter 45 Creating Custom Event Gateways in ColdFusion MX Developer s Guide Usage This method returns...

Страница 967: ...coldfusion eventgateway GatewayHelper class instance or null if the gateway does not have a GatewayHelper class Usage ColdFusion calls this method when a ColdFusion MX application calls the CFML GetG...

Страница 968: ...Gateway class service and information routines in Chapter 45 Creating Custom Event Gateways in ColdFusion MX Developer s Guide Returns An integer status value The Gateway interface defines the followi...

Страница 969: ...oldFusion application calls the SendGatewayMessage function ColdFusion MX passes the String returned by this method back as the return value of a CFML SendGatewayMessage function Example The following...

Страница 970: ...ad st SocketServerThread socketRegistry get data get OriginatorID if st null st writeOutput message else log error Cannot send outgoing message OriginatorID data get OriginatorID is not a valid socket...

Страница 971: ...blic void restart See also start stop Usage In most cases you implement this method as a call to the stop method followed by a start method but you may be able to optimize the restart method based on...

Страница 972: ...s method with the names in the instance s listener list in the ColdFusion MX Administrator ColdFusion MX can also call this method if the ColdFusion MX Administrator listener list changes while the ga...

Страница 973: ...loper s Guide Parameters Usage This method sets a string value that is returned by the getGatewayID method ColdFusion MX calls this method to set the gateway ID with the value specified in the gateway...

Страница 974: ...d should update the status information that is returned by the getStatus method to indicate when the gateway is starting and when the gateway is running The ColdFusion MX Administrator Gateway Types p...

Страница 975: ...urces The ColdFusion MX Administrator calls this function when it stops a gateway instance This method should update the status information that is returned by the getStatus method to indicate when th...

Страница 976: ...efine a class that provides gateway specific utility methods to the ColdFusion application or listener CFC For example an instant messaging event gateway might use a helper class to provide buddy list...

Страница 977: ...at returns the GatewayServices object boolean addEvent CFEvent msg Sends a CFEvent instance to ColdFusion for dispatching to a listener CFC coldfusion eventgateway Logger getLogger String logfile Retu...

Страница 978: ...ing Custom Event Gateways in ColdFusion MX Developer s Guide Returns The GatewayServices object Usage Gateway constructors can call this method to get a convenient reference to the GatewayServices cla...

Страница 979: ...ng messages to the application for processing Example The following example from the ColdFusion MX SocketGateway code sends an event to all listener CFCs for int i 0 i listeners length i String path l...

Страница 980: ...ption information in the exceptions log file Example The ColdFusion MX example DirectoryWatcherGateway includes the following line in the constructor to get a logger object We create our own log file...

Страница 981: ...You can use this method and the getQueueSize method to control the rate of event queuing and to help diagnose any throughput problems in your gateways Example The following example logs the queue siz...

Страница 982: ...getMaxQueueSize method to control the rate of event queuing and to help diagnose any throughput problems in your gateways Example The following example logs the queue size maximum queue size and other...

Страница 983: ...tring gatewayID CFEvent constructor String getGatewayID Returns the gateway ID set in the CFEvent constructor void setCFCMethod String method String getCFCMethod Sets or gets the name of the CFC metho...

Страница 984: ...code for the ColdFusion asynchronous CFML gateway sends a message to that the gateway has received to a CFC public String outgoingMessage coldfusion eventgateway CFEvent cfmsg Get the data Map data c...

Страница 985: ...the method that gateway services will call in the listener CFC as set by the setCFCMethod method If setCFCMethod has not been called returns null and not onIncomingMessge which ColdFusion gateway ser...

Страница 986: ...h to the application listener CFC that will process the event as set by the setCFCPath method If the setCFCPath method has not been called returns null not the path specified in the ColdFusion Adminis...

Страница 987: ...Gateways in ColdFusion MX Developer s Guide Returns The listener CFC time out in seconds as set by the setCFCTimeout method or null Usage Most gateways do not need to use this function When ColdFusio...

Страница 988: ...command Note The returned Map object has case insensitive keys Example The following outgoingMessage method from the SocketGateway example gateway gets the message contents from the CFEvent data fiel...

Страница 989: ...t See also CFEvent CFML CFEvent structure on page 1004 CFEvent class in Chapter 45 Creating Custom Event Gateways in ColdFusion MX Developer s Guide Returns The gateway ID of the CFEvent object or nul...

Страница 990: ...ect Category Event Gateway Development Syntax String getGatewayType See also setGatewayType CFML CFEvent structure on page 1004 CFEvent class in Chapter 45 Creating Custom Event Gateways in ColdFusion...

Страница 991: ...response back to the originator does not have to explicitly set a destination in the return variable If the field is empty as it is in messages sent by the CFML SendGatewayMessage function the gateway...

Страница 992: ...er methods for different message types uses this method to identify the destination method Example The following example code comes from the ColdFusion XMPP gateway incoming message handler It creates...

Страница 993: ...cket gateway processInput method that takes input from the socket and sends it to the CFC listener methods The listeners variable contains an array of listener CFCS and is set by the gateway s setCFCL...

Страница 994: ...o not use this method ColdFusion uses the Timeout Request value set on the Server Settings page in the ColdFusion MX Administrator Use this method if your messages require a longer or shorter time out...

Страница 995: ...a result do not create entries in the data with names that differ only in case Example The following code shows the routine from the example JMS gateway that handles incoming messages It puts the JMS...

Страница 996: ...s those in an instant messaging application that handles multiple instant messaging providers could use this field to determine the protocol type and any gateway type specific actions Example The foll...

Страница 997: ...hat handles incoming messages It sets the originator ID to the name of the JMS topic that the gateway handles public void handleMessage String msg String topicName String msgID coldfusion eventgateway...

Страница 998: ...dFusion logs directory You set this directory on the ColdFusion MX Administrator Logging Settings page The coldfusion eventgateway GatewayServices getLogger method returns an instance of the Logger cl...

Страница 999: ...er configuration or cf_root WEB INF cfusion lib neo logging xml in the J2EE configuration Change the following entry var name priority string information string var to the following var name priority...

Страница 1000: ...messages with a severity of error to the log file specified in the getLogger method that returned the Logger instance or the default log file Example The ColdFusion MX example SocketGateway class inc...

Страница 1001: ...Chapter 45 Creating Custom Event Gateways in ColdFusion MX Developer s Guide Parameters Usage Use this method to send a fatal error message to the ColdFusion MX logging subsystem ColdFusion MX will w...

Страница 1002: ...he log file specified in the getLogger method that returned the Logger instance or the default log file ColdFusion normally logs all information severity messages so you should not use this severity f...

Страница 1003: ...default log file Example The ColdFusion MX example SocketWatcherGateway class includes the following code in its constructor to load a configuration file If it cannot load the file it converts the exc...

Страница 1004: ...alls the SendGatewayMessage function to respond to the event gateway it uses this ID as the function s first parameter Data A structure containing the event data including the message The Data structu...

Страница 1005: ...the method names and disable event types in the gateway configuration file Method Message type onAddBuddyRequest Requests from other IM users to add the gateway ID as their buddy onAddBuddyResponse Re...

Страница 1006: ...cfcMethod This CFC method by default onAddBuddyRequest data MESSAGE The message that was sent with the request data SENDER The sender s ID identical to the originatorID field value data RECIPIENT The...

Страница 1007: ...take no action if buddysearch RecordCount IS 0 action decline reason Invalid ID else if buddysearch RecordCount IS 1 action accept reason Valid ID Add the buddy to the buddy status structure only if a...

Страница 1008: ...1008 Chapter 6 ColdFusion MX Event Gateway Reference cfset retValue Reason reason cfreturn retValue cffunction...

Страница 1009: ...cflock scope APPLICATION timeout 10 type EXCLUSIVE cfscript Do the following only if the buddy accepted the request if NOT StructKeyExists Application buddyStatus Application buddyStatus StructNew if...

Страница 1010: ...Data SENDER status Buddy accepted us Application buddyStatus CFEvent Data SENDER timeStamp CFEvent Data TIMESTAMP Application buddyStatus CFEvent Data SENDER message CFEvent Data MESSAGE cfscript cflo...

Страница 1011: ...AMETIME gatewayID The ID of the Gateway instance as configured in ColdFusion MX Administrator originatorID The IM ID buddy name of the message originator cfcMethod This CFC method by default onIMServe...

Страница 1012: ...ructKeyExists Application buddyStatus CFEvent Data BUDDYNAME Application buddyStatus CFEvent Data BUDDYNAME StructNew Save the buddy status timestamp and custom away message Application buddyStatus CF...

Страница 1013: ...ssage cfargument name CFEvent type struct required YES cflog file CFEvent GatewayID Status text onIMServerMEssage SENDER CFEvent OriginatorID MESSAGE CFEvent Data MESSAGE TIMESTAMP CFEvent Data TIMEST...

Страница 1014: ...mple shows a simple onIncomingMessage method that echoes a message back to the sender cffunction name onIncomingMessage cfargument name CFEvent type struct required YES cfset input_mesg CFEvent data M...

Страница 1015: ...FC incoming message methods 1015 cfset retValue structNew cfset retValue command submit cfset retValue buddyID CFEvent originatorID cfset retValue message Message Received input_mesg cfreturn retValue...

Страница 1016: ...r no command because submit is the default command in SendGatewayMessage CFML functions and the return value of the onIncomingMessage CFC method Command Description submit Default Sends a normal messa...

Страница 1017: ...tion includes the following methods addBuddy getDenyList getStatusAsString removeDeny addDeny getName getStatusTimeStamp removePermit addPermit getNickName isOnline setNickName getBuddyInfo getPermitL...

Страница 1018: ...e from the buddy so it returns True and the gateway adds the buddy to the list even if the buddy denies the subscription request Use the listener CFC onAddBuddyResponse method to monitor the buddy s r...

Страница 1019: ...in the XMPP 1 0 draft specification but several XMPP servers that were available at the time of the ColdFusion MX 7 release do not support permission management If the server does not support permiss...

Страница 1020: ...uded in the XMPP 1 0 draft specification but several XMPP servers that were available at the time of the ColdFusion MX 7 release do not support permission management If the server does not support per...

Страница 1021: ...o information for a field it is blank Parameter Description name The unique instant messaging user name for the person about whom you want to get information Field Description BUDDYNAME The user s uni...

Страница 1022: ...BUDDYLISTTIYPE The type of list that this buddy record is in one of the following BUDDY_LIST The list of users whose presence status information the gateway can receive DENY_LIST The list of users wh...

Страница 1023: ...in Chapter 43 Using the Instant Messaging Event Gateways in ColdFusion MX Developer s Guide Returns An array of IDs buddy names of the users on the gateway s buddy list a list of instant messaging IDs...

Страница 1024: ...AsString getStatusTimeStamp isOnline setStatus Using the GatewayHelper object in Chapter 43 Using the Instant Messaging Event Gateways of ColdFusion MX Developer s Guide Returns The gateway s custom a...

Страница 1025: ...Developer s Guide Returns An array of IDs buddy names of the users on the gateway s deny list the list of IDs to which the IM server does not send presence status information Note XMPP permission mana...

Страница 1026: ...sagesSent setNickName Using the GatewayHelper object in Chapter 43 Using the Instant Messaging Event Gateways of ColdFusion MX Developer s Guide Returns The gateway s user name as specified in gateway...

Страница 1027: ...etProtocolName numberOfMessagesReceived numberOfMessagesSent setNickName Using the GatewayHelper object in Chapter 43 Using the Instant Messaging Event Gateways of ColdFusion MX Developer s Guide Retu...

Страница 1028: ...y of IDs buddy names of the users on the gateway s permit list the list of IDs to which the IM server sends presence status information if the permit mode is set to PERMIT_SOME Note XMPP permission ma...

Страница 1029: ...llowing values Note XMPP permission management is included in the XMPP 1 0 draft specification but several XMPP servers that were available at the time of the ColdFusion MX 7 release do not support pe...

Страница 1030: ...ssagesSent setNickName Using the GatewayHelper object in Chapter 43 Using the Instant Messaging Event Gateways in ColdFusion MX Developer s Guide Returns The gateway s protocol as determined by the ga...

Страница 1031: ...Fusion MX Developer s Guide Returns The gateway s online status one of the following ONLINE OFFLINE AWAY DO NOT DISTURB XMPP only NOT AVAILABLE FREE TO CHAT Sametime only IDLE Usage The DO NOT DISTURB...

Страница 1032: ...isOnline setStatus Using the GatewayHelper object in Chapter 43 Using the Instant Messaging Event Gateways in ColdFusion MX Developer s Guide Returns The date and time that the gateway changed its onl...

Страница 1033: ...AsString getStatusTimeStamp setStatus Using the GatewayHelper object in Chapter 43 Using the Instant Messaging Event Gateways in ColdFusion MX Developer s Guide Returns True if the gateway is connecte...

Страница 1034: ...ickName getProtocolName numberOfMessagesSent setNickName Using the GatewayHelper object in Chapter 43 Using the Instant Messaging Event Gateways in ColdFusion MX Developer s Guide Returns The number o...

Страница 1035: ...ProtocolName numberOfMessagesReceived setNickName Using the GatewayHelper object in Chapter 43 Using the Instant Messaging Event Gateways in ColdFusion MX Developer s Guide Returns The number of messa...

Страница 1036: ...ns True if the ID was removed from the group False otherwise Usage If the user is in multiple groups in your buddy list you remove the buddy separately from each group The IM server does not stop send...

Страница 1037: ...1 0 draft specification but several XMPP servers that were available at the time of the ColdFusion MX 7 release do not support permission management If the server does not support permission manageme...

Страница 1038: ...0 draft specification but several XMPP servers that were available at the time of the ColdFusion MX 7 release do not support permission management If the server does not support permission management...

Страница 1039: ...hapter 43 Using the Instant Messaging Event Gateways in ColdFusion MX Developer s Guide Parameters Returns True if the nickname got set false otherwise Example See GatewayHelper example in Chapter 43...

Страница 1040: ...ncluded in the XMPP 1 0 draft specification but several XMPP servers that were available at the time of the ColdFusion MX 7 release do not support permission management If the server does not support...

Страница 1041: ...s method to go offline Although the method accepts a parameter of OFFLINE the gateway immediately resets itself to be online To set the gateway offline stop the gateway instance in the ColdFusion MX A...

Страница 1042: ...vent structure and commands This section describes the detailed contents of the following structures that you use in the SMS Gateway listener CFCs and CFML SendGatewayMessage functions SMS Gateway inc...

Страница 1043: ...t xx0100xx SME Manual User Acknowledgement xx0110xx Conversation abort Korean CDMA only xx1000xx Intermediate Delivery Notification For more information on this field see the SMPP specification Data p...

Страница 1044: ...ents as follows 00000000 SMSC Default Alphabet 00000001 IA5 CCITT T 50 ASCII ANSI X3 4 00000010 Octet unspecified 8 bit binary 00000011 Latin 1 ISO 8859 1 00000100 Octet unspecified 8 bit binary 00000...

Страница 1045: ...SMS gateway message sending commands ColdFusion applications that use gateways of the Short Message Service SMS type can send the following commands to the event gateway in an outgoing message submit...

Страница 1046: ...messagePayload The message contents You must specify one of these fields but not both The SMPP specification imposes a maximum size of 254 bytes on the shortMessage field and some carriers might limit...

Страница 1047: ...sage originator cffunction name onIncomingMessage output no cfargument name CFEvent type struct required yes Create a return structure that contains the message cfset retValue structNew cfset retValue...

Страница 1048: ...e of these fields but not both The SMPP specification imposes a maximum size of 254 bytes on the shortMessage field and some carriers might limit its size further The messagePayload field can contain...

Страница 1049: ...FEvent type struct required yes Get the message cfset data cfevent DATA cfset message data message Create the return structure cfset retValue structNew cfset retValue command submitmulti cfset retValu...

Страница 1050: ...values Field Contents command Must be data messagePayload The message data To convert data to binary format use the ColdFusion MX ToBinary function destAddress The address to which to send the messag...

Страница 1051: ...nIncomingMessage output no cfargument name CFEvent type struct required yes Get the message cfset data CFEvent DATA cfset message data message Create the return structure cfset retValue structNew cfse...

Страница 1052: ...le with data to log props file GenericCFCtest props type warning status SendGatewayMessage DefaultCFC props if status IS True WriteOutput Event Message props Message has been sent cfscript Field Use c...

Страница 1053: ...and message cfcomponent cffunction name logEvent output no cfargument name CFEvent type struct required yes cfscript if NOT IsDefined CFEvent Data file CFEvent Data file defaultEventLog if NOT IsDefin...

Страница 1054: ...1054 Chapter 6 ColdFusion MX Event Gateway Reference...

Страница 1055: ...CCFXException class 1056 CCFXQuery class 1058 CCFXRequest class 1062 CCFXStringSet class 1072 C class overview The following table lists the CFXAPI classes and methods Class Methods CCFXException clas...

Страница 1056: ...uteExists CCFXRequest CreateStringSet CCFXRequest Debug CCFXRequest GetAttribute CCFXRequest GetAttributeList CCFXRequest GetCustomData CCFXRequest GetQuery CCFXRequest ReThrowException CCFXRequest Se...

Страница 1057: ...from CFX_FOO2 pRequest ThrowException User Error You goof d Output optional debug info if pRequest Debug pRequest WriteDebug Debug info Catch ColdFusion exceptions re raise them catch CCFXException e...

Страница 1058: ...Query GetColumns retrieves a list of a query s column names virtual LPCSTR GetData int iRow int iColumn CCFXQuery GetData retrieves a data element from a row and column of a query virtual LPCSTR GetNa...

Страница 1059: ...n Retrieves a list of the column names contained in a query Returns Returns an object of CCFXStringSet class that contains a list of the columns in the query ColdFusion automatically frees the memory...

Страница 1060: ...urned string set Returns Returns the value of the requested data element Parameters Example The following example iterates over the elements of a query and writes the data in the query back to the use...

Страница 1061: ...CCFXQuery pQuery pRequest GetQuery char buffOutput 256 wsprintf buffOutput The number of rows in the query is ld pQuery GetRowCount pRequest Write buffOutput CCFXQuery SetData Syntax void CCFXQuery S...

Страница 1062: ...tom extension for the following actions Reading and writing variables Returning output Creating and using queries Throwing exceptions Class methods virtual BOOL AttributeExists LPCSTR lpszName CCFXReq...

Страница 1063: ...et pColumns CCFXRequest AddQuery adds a query to the template that contains this tag virtual BOOL Debug CCFXRequest Debug checks whether the tag contains the Debug attribute virtual void WriteDebug LP...

Страница 1064: ...ry SetData iRow iLastName Smith iRow pQuery AddRow pQuery SetData iRow iFirstName Jane pQuery SetData iRow iLastName Doe CCFXRequest AttributeExists Syntax BOOL CCFXRequest AttributeExists LPCSTR lpsz...

Страница 1065: ...ddString Blue CCFXRequest Debug Syntax BOOL CCFXRequest Debug void Description Checks whether the tag contains the Debug attribute Use this function to determine whether to write debug information for...

Страница 1066: ...ue of one attribute use CCFXRequest GetAttribute Returns Returns an object of class CCFXStringSet class that contains a list of attributes passed to the tag The memory allocated for the returned strin...

Страница 1067: ...tWork CCFXRequest pRequest MYTAGDATA pTagData MYTAGDATA pRequest GetCustomData remainder of procedure CCFXRequest GetQuery Syntax CCFXQuery CCFXRequest GetQuery void Description Retrieves a query that...

Страница 1068: ...on is used to avoid having C exceptions that are thrown by DLL extension code propagate back into ColdFusion Catch ALL C exceptions that occur in extension code and either re throw them if they are of...

Страница 1069: ...id ProcessTagRequest CCFXRequest pRequest try MYTAGDATA tagData pRequest SetCustomData LPVOID tagData remainder of procedure CCFXRequest SetVariable Syntax void CCFXRequest SetVariable LPCSTR lpszName...

Страница 1070: ...nds processing of a request Call this function when you encounter an error that does not allow you to continue processing the request This function is almost always combined with the CCFXRequest ReThr...

Страница 1071: ...STINATION pRequest Write buffOutput CCFXRequest WriteDebug Syntax void CCFXRequest WriteDebug LPCSTR lpszOutput Description Writes text output into the debug stream The text is only displayed to the e...

Страница 1072: ...ings to a string set and saving the indexes of the items that are added CCFXStringSet pSet pRequest CreateStringSet int iRed pSet AddString Red int iGreen pSet AddString Green int iBlue pSet AddString...

Страница 1073: ...tString i pRequest Write BR CCFXStringSet GetIndexForString Syntax int CCFXStringSet GetIndexForString LPCSTR lpszString Description Searches for a passed string The search is case insensitive Returns...

Страница 1074: ...Returns Returns the string located at the passed index Parameters Example The following example demonstrates GetString with CCFXStringSet GetCount to iterate over a string set and write the contents...

Страница 1075: ...iew 1075 Custom tag interface 1076 Query interface 1077 Request interface 1082 Response interface 1087 Debugging classes reference 1090 Class libraries overview The following Java interfaces are avail...

Страница 1076: ...available using the Request object passed to the processRequest method Methods processRequest Description Processes a request originating from the Java CFX tag Category Custom tag interface Syntax pu...

Страница 1077: ...that has three columns City State and Zip Define column indexes Parameter Description request Parameters attributes query and so on for this request response Interface for generating response to requ...

Страница 1078: ...if no such column exists Category Query interface Syntax public int getColumnIndex String name See also getColumns getData Parameters Example The following example retrieves the index of the EMAIL col...

Страница 1079: ...ns length Print the list of columns to the user response write Columns in query for int i 0 i nNumColumns i response write columns i getData Description Retrieves a data element from a row and column...

Страница 1080: ...ow iCol response write BR getName Description Returns the name of a query Category Query interface Syntax public String getName Example The following example retrieves the name of a query and writes i...

Страница 1081: ...setData Category Query interface Syntax public void setData int iRow int iCol String data Throws IndexOutOfBoundsException If an invalid index is passed to the method See also getData addRow Parameter...

Страница 1082: ...name See also getAttribute getAttributeList Parameters Returns Syntax Description boolean attributeExists String name Checks whether the attribute was passed to this tag boolean debug Checks whether t...

Страница 1083: ...tag contains the debug attribute False otherwise Category Request interface Syntax public boolean debug See also writeDebug Example The following example checks whether the debug attribute is present...

Страница 1084: ...ieve the value of one attribute use the getAttribute method Returns an array of strings containing the names of the attributes passed to the tag Category Request interface Syntax public String getAttr...

Страница 1085: ...is not a valid number See also attributeExists getAttributeList getIntAttribute Parameters Example The following example retrieves an attribute named PORT and writes its value back to the user int nPo...

Страница 1086: ...ion Registry key Returns the value of the custom tag setting If no setting of that name exists an empty string is returned Category Request interface Syntax public String getSetting String name Parame...

Страница 1087: ...String columns Throws IllegalArgumentException If the name parameter is not a valid CFML variable name See also addRow setData Parameters Example The following example adds a query named People to the...

Страница 1088: ...ists in the template its value is replaced If it does not exist a new variable is created Category Response interface Syntax public void setVariable String name String value Throws IllegalArgumentExce...

Страница 1089: ...output into the debug stream This text is displayed to the end user only if the tag contains the debug attribute check for this attribute using the Request debug method Category Response interface Sy...

Страница 1090: ...uest with attributes and a query public DebugRequest Hashtable attributes Query query initialize a debug request with attributes a query and settings public DebugRequest Hashtable attributes Query que...

Страница 1091: ...ese are the JavaScript objects and functions WDDX JavaScript objects are defined in the wddx js file this file is installed in the CFIDE scripts directory To use these objects you must put a JavaScrip...

Страница 1092: ...WddxRecordset instance Example This example shows a JavaScript function that you can call to serialize a WddxRecordset instance It copies serialized data to a form field for display function serializ...

Страница 1093: ...ters Return value Returns a Boolean True if serialization was successful False otherwise This is an internal function you do not typically call it Example This example is from the WddxSerializer seria...

Страница 1094: ...alue Returns a Boolean True if obj was serialized successfully False otherwise Usage This is an internal function you do not typically call it Example This example is from the WddxSerializer serialize...

Страница 1095: ...lue this write boolean value obj WddxRecordset object Includes functions that you call as needed when constructing a WDDX record set For more information on using this object see Using WDDX in Chapter...

Страница 1096: ...ddx js script script Use WDDX to move from CFML data to JS cfwddx action cfml2js input q topLevelVariable qj Dump the record set document write qj dump true script addColumn Description Adds a column...

Страница 1097: ...eviously defined variable rs setField 0 NewColumn newValue addRows Description Adds rows to all columns in a WddxRecordset instance Syntax object addRows n Parameters Return value None Usage This func...

Страница 1098: ...position Usage Call this function to access a value in a WDDX record set Example This example calls the getField function the variable r is a reference to a WddxRecordset instance for row 0 row nRows...

Страница 1099: ...Description Sets the element in the specified row column position Syntax object setField row col value Parameters Return value None Usage Call this function to set a value in a WddxRecordset instance...

Страница 1100: ...eturn value Returns a Boolean True if serialization was successful False otherwise Usage This is an internal function you do not typically call it Example This example is from the WddxSerializer seria...

Страница 1101: ...R 10 ColdFusion ActionScript Functions This chapter explains the syntax and usage of the two Macromedia ColdFusion MX 7 server side ActionScript functions CF query and CF http Contents CF query 1102 C...

Страница 1102: ...a shorthand coding style does not support all arguments Use the following syntax to code the CF query function using positional arguments CF query datasource sql CF query datasource sql maxrows CF qu...

Страница 1103: ...ailed information about the RecordSet ActionScript class see Using Flash Remoting Example Define a function to do a basic query Note use of positional arguments function basicQuery result CF query myq...

Страница 1104: ...rd resolveurl yes or no params arrayvar path path file filename Arguments Arguments Req Opt Description method Required One of two arguments get downloads a text or binary file or creates a query from...

Страница 1105: ...at is returned into the Filecontent property has its internal URLs fully resolved including port number so that links remain intact The following HTML tags which can contain links are resolved img src...

Страница 1106: ...cified URL location contains text data Charset The charset used by the document specified in the URL HTTP servers normally provide this information or the charset is specified in the charset parameter...

Страница 1107: ...rams 3 name arg3 type CGI value value3 url http localhost 8100 path application getContext getRealPath file foo txt result CF http method post url url username karl password salsa resolveurl true para...

Страница 1108: ...s new Array params 1 name arg2 type URL value value2 url http localhost 8100 Invoke with the method url and params result CF http post url params return result get Filecontent Example with username an...

Отзывы: