MACROMEDIA COLDFUSION 5-CFML Reference

Other manuals for COLDFUSION 5-CFML: Quick Reference

Summary of COLDFUSION 5-CFML

  • Page 1

    Macromedia® incorporated cfml reference coldfusion 5.

  • Page 2: Copyright Notice

    Copyright notice © 2001 macromedia incorporated. All rights reserved. This manual, as well as the software described in it, is furnished under license and may be used or copied only in accordance with the terms of such license. The content of this manual is furnished for informational use only, is s...

  • Page 3: Contents

    Contents about this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Xv intended audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Xvi developer resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

  • Page 4: Chapter 2 Coldfusion Tags

    Iv contents function syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 optional function arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 pound signs . . . . . . . . . . . . . . . . . . . . . . . . ...

  • Page 5

    Contents v how data is returned from cfgrid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 using the href attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 cfgridcolumn . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

  • Page 6: 307

    Vi contents cftextinput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 cfthrow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 cftransaction . . . . . . ...

  • Page 7

    Contents vii atn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342 authenticatedcontext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 authenticateduser . . . . . . . ...

  • Page 8

    Viii contents exp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413 expandpath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414 fileexists . . . . . . ...

  • Page 9

    Contents ix isnumericdate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471 isprotected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 isquery . . . . . . . . . . . . . ...

  • Page 10

    X contents min . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542 minute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543 month . . . . . . . ...

  • Page 11: . . . . . . . .

    Contents xi structfind . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609 structfindkey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610 structfindvalue . . . . . . . ....

  • Page 12: . . . . . . .

    Xii contents ccfxrequest::addquery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656 ccfxrequest::attributeexists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656 ccfxrequest::createstringset . . . . . . . . . . . . . . . . . . . . . ....

  • Page 13: 685

    Contents xiii methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680 addquery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680 setvariable . . . . . . . . . . . . . ....

  • Page 14

    Xiv contents.

  • Page 15: About This Book

    About this book the cfml reference is your primary coldfusion markup language (cfml) reference guide. Use this guide to learn about individual cfml tags and functions, as well as coldfusion expressions, using javascript objects for wddx in coldfusion. You can also find detailed references for java a...

  • Page 16: Intended Audience

    Xvi about this book intended audience the cfml reference is intended for coldfusion developers building pages and writing cfml code. Developer resources macromedia corporation is committed to setting the standard for customer support in developer education, technical support, and professional servic...

  • Page 17: Viewing Online Documentation

    About coldfusion documentation xvii about coldfusion documentation coldfusion documentation is designed to provide support for the complete spectrum of participants. The print and online versions are organized to allow you to quickly locate the information that you need. The coldfusion online docume...

  • Page 18: Getting Answers

    Xviii about this book getting answers one of the best ways to solve particular programming problems is to tap into the vast expertise of the coldfusion developer communities on the coldfusion forums. Other developers on the forum can help you figure out how to do just about anything with coldfusion....

  • Page 19: Coldfusion Expressions:

    Chapter 1 coldfusion expressions: operands, operators and other constructs this chapter describes coldfusion expressions — language constructs that let you create sophisticated applications. Contents • elements of coldfusion expressions ..................................................................

  • Page 20

    2 chapter 1 coldfusion expressions: operands, operators and other constructs elements of coldfusion expressions coldfusion expressions consist of operands and operators. Operands are comprised of constants and variables. Operators are the verbs that act on the operands; functions are a form of opera...

  • Page 21

    Elements of coldfusion expressions 3 string text values, which can be enclosed in single (’) or double (") quotes. String length is limited only by the amount of available memory on the coldfusion server. To use a single quote inside a string that is single quoted, escape, or repeat, the single quot...

  • Page 22

    4 chapter 1 coldfusion expressions: operands, operators and other constructs list lists are a kind of string made up of elements separated by delimiters. The default delimiting character used by list processing functions is a comma. A list can have more than one delimiting character. You specify the...

  • Page 23: Century Dates

    Elements of coldfusion expressions 5 notes on date-and-time values this section contains information about how date and time variables are handled by coldfusion. How date and time values are stored coldfusion represents date-and-time values internally on a time line as a subset of the real numbers. ...

  • Page 24: Variables

    6 chapter 1 coldfusion expressions: operands, operators and other constructs variables variables are the most frequently used operands. Variable values can be set and reset, and passed as attributes to cfml tags and jrun servlets. They can be passed as parameters to functions, and can replace most c...

  • Page 25

    Variables 7 form field the most common way of passing parameters to a page. When a user enters data in a form field, a parameter with the name of the form field is passed to the action page. Form fields are stored in structures. For more information, see “variables stored in structures” on page 12 ....

  • Page 26

    8 chapter 1 coldfusion expressions: operands, operators and other constructs qualifying, or scoping, variable references coldfusion distinguishes between identically named parameters from different sources by using a different prefix for each source. Specifying a variable’s source is known as “scopi...

  • Page 27: Scopes and Variables

    Variables 9 although you are not required to use the scope prefix unless two variables in different scopes have the same name, it is recommended for readability and processing speed that you use prefixes. For example, the variable form.Lastname is clearer than a variable called simply lastname . Tip...

  • Page 28: Performance and Scoping

    10 chapter 1 coldfusion expressions: operands, operators and other constructs performance and scoping you can improve performance by qualifying variables with the proper scope. Adding variable scopes improves processing speed, but the trade-off is that it may reduce the ease of code reuse. In the fo...

  • Page 29

    Variables 11 note coldfusion does not attempt to automatically find application, session, server, request, or cfml tag variables (except file variables). You must use prefixes with these variables. The following scopes are exposed as coldfusion structures: • form • url • attributes • request • cgi •...

  • Page 30

    12 chapter 1 coldfusion expressions: operands, operators and other constructs note when variables are available to several application pages, keep track of your variable names. For more information, see “variable naming conventions” on page 6 . For information on setting up client state management u...

  • Page 31: Cgi Environment Variables

    Cgi environment variables 13 cgi environment variables when a browser makes a request to a server, environment variables are created by the web server and by the browser. In coldfusion, these variables are referred to as cgi environment variables and they use the "cgi" prefix (even if your server us...

  • Page 32: Cgi Client Variables

    14 chapter 1 coldfusion expressions: operands, operators and other constructs cgi client variables the following table describes common cgi environment variables that are created by the browser and passed in the request header: request_method method with which the request was made. For http, this is...

  • Page 33

    Cgi environment variables 15 cgi client certificate variables coldfusion makes available the following client certificate data. These variables are available when running microsoft iis 4.0 or netscape enterprise under ssl if your web server is configured to accept client certificates. Http_user_agen...

  • Page 34: Operators

    16 chapter 1 coldfusion expressions: operands, operators and other constructs operators operators combine subexpressions to create complex expressions. Operators act on the operands. The general syntax for using operators is: expression operator expression coldfusion has four types of operators: • a...

  • Page 35: Decision Operators

    Operators 17 decision operators coldfusion’s decision, or comparison, operators produce a boolean true/false result. The decision operators are shown in the following table. Shorthand notation for decision operators you can replace some decision operators with shorthand notations to make your cfml m...

  • Page 36: String Operators

    18 chapter 1 coldfusion expressions: operands, operators and other constructs string operators there is one string operator, which is the concatenation operator. Operator precedence the order of precedence controls the order in which operators on the same line are evaluated. The order of precedence ...

  • Page 37: Functions As Operators

    Functions as operators 19 functions as operators functions are a form of operator. Because coldfusion functions return basic objects, such as numbers, strings, boolean values, date-and-time objects, lists, arrays, structures, queries, and com objects, function results can be used as operands. The fo...

  • Page 38: Pound Signs

    20 chapter 1 coldfusion expressions: operands, operators and other constructs pound signs pound signs (#) have a special meaning in cfml. Coldfusion treats text delimited by pound signs differently from plain text. When coldfusion processes an expression, it replaces the text of the expression and t...

  • Page 39: Pound Signs In Strings

    Pound signs 21 complex expressions and cfoutput tags complex expressions, which contain more that one variable or function, cannot be inserted inside cfoutput tags. The following example produces an error: 1 + 1 is #1 + 1# to insert the value of a complex expression in the output generated by a cfou...

  • Page 40: Nested Pound Signs

    22 chapter 1 coldfusion expressions: operands, operators and other constructs to insert the value of a complex expression inside a string, do one of the following: • use cfset to set a variable to the value of the expression and use that variable inside the string • use the string concatenation oper...

  • Page 41

    Pound signs 23 the existence of nested pounds implies a complex expression. For example, the above cfml code could be rewritten to improve its readability: is #len(fullname)#"> a common mistake is to put pound signs around the arguments of functions, as in: these statements result in errors. As a ge...

  • Page 42

    24 chapter 1 coldfusion expressions: operands, operators and other constructs.

  • Page 43: Coldfusion Tags

    Chapter 2 coldfusion tags this chapter describes the coldfusion markup language (cfml) tags. The introduction contains an alphabetical summary of coldfusion tags, a list of new tags in coldfusion 5, and a list of tags by category. The rest of this chapter describes each tag in detail. Contents • alp...

  • Page 44

    26 chapter 2 coldfusion tags alphabetical list of coldfusion tags coldfusion markup language (cfml) consists of a set of tags you use in coldfusion pages to interact with data sources, manipulate data, and display output. Using cfml tags is very simple; tag syntax is much like html element syntax. T...

  • Page 45

    Alphabetical list of coldfusion tags 27 cfflush data output flushes currently available data to the client. Cfform form builds an input form; performs client-side input validation. Cfftp internet protocol permits ftp file operations. Cfgraph data output displays a graphical representation of data. C...

  • Page 46

    28 chapter 2 coldfusion tags cfloop flow-control repeats a set of instructions based on a set of conditions. Cfmail internet protocol assembles and posts an e-mail message. Cfmailparam internet protocol attaches a file or adds a header to an e-mail message. Cfmodule web app. Framework invokes a cust...

  • Page 47

    Alphabetical list of coldfusion tags 29 cfselect form used in cfform to create a drop-down list box form element. Cfservlet extensibility, java executes a java servlet on a jrun engine. Cfservletparam extensibility, java passes data to a java servlet. A child tag of cfservlet . Cfset variable manipu...

  • Page 48: New Tags In Coldfusion 5

    30 chapter 2 coldfusion tags new tags in coldfusion 5 forms tags database manipulation tags data output tags exception handling tags cfflush cfgraph cfgraphdata cflog cfsavecontent cfdump cfapplet cfgridrow cfslider cfform cfgridupdate cftextinput cfgrid cfinput cftree cfgridcolumn cfselect cftreeit...

  • Page 49: Extensibility Tags

    Alphabetical list of coldfusion tags 31 extensibility tags file management tags flow-control tags internet protocol tags java servlet and java object tags page processing tags cfcollection cfreport cfexecute cfsearch cfgraph cfservlet cfindex cfservletparam cfobject cfwddx cfdirectory cffile cfabort...

  • Page 50: Variable Manipulation Tags

    32 chapter 2 coldfusion tags variable manipulation tags web application framework tags cfheader cfsilent cfhtmlhead cfcookie cfsavecontent cfdump cfschedule cfparam cfset cfregistry cfapplication cflock cfassociate cfmodule cfauthenticate cfscript cfimpersonate.

  • Page 51

    Alphabetical list of coldfusion tags 33 cfabort description stops processing of a page at the tag location. Coldfusion returns everything that was processed before the cfabort tag. The cfabort tag is often used with conditional logic to stop processing a page when a condition occurs. Category flow-c...

  • Page 52

    34 chapter 2 coldfusion tags the value of myvariable after incrementing through the loop #counter# times is: #myvariable# the value of myvariable after incrementing through the loop #counter# times is: #myvariable#.

  • Page 53

    Alphabetical list of coldfusion tags 35 cfapplet description used in a cfform tag, cfapplet lets you reference custom java applets that you have registered using the coldfusion administrator. To register a java applet, open the coldfusion administrator and click applets. Category forms tags syntax n...

  • Page 54

    36 chapter 2 coldfusion tags usage since java applets must be pre-registered, the cfapplet tag can be very simple, taking the default parameter values as they were registered in the coldfusion administrator. You can also override parameters by invoking them in the cfapplet tag. Example used in a cff...

  • Page 55

    Alphabetical list of coldfusion tags 37 cfapplication description defines scoping for a coldfusion application, enables or disables storing client variables, and specifies a client variable storage mechanism. By default, client variables are disabled. Also, enables session variables and sets timeout...

  • Page 56

    38 chapter 2 coldfusion tags usage the cfapplication tag is typically used in the application.Cfm file to set defaults for a specific coldfusion application. The cfapplication tag enables application variables unless they are disabled in the coldfusion administrator. The coldfusion administrator set...

  • Page 57

    Alphabetical list of coldfusion tags 39 cfapplication defines scoping for a coldfusion application and enables or disables the storing of application and/or session variables. This tag is placed in a special file called application.Cfm that is run before any other cf template in a directory where th...

  • Page 58

    40 chapter 2 coldfusion tags cfassociate description allows subtag data to be saved with the base tag. Applies only to custom tags. Category web application framework tags syntax datacollection = "collection_name"> see also cfapplication , cfauthenticate , cferror , cflock , cfmodule attributes usag...

  • Page 59

    Alphabetical list of coldfusion tags 41 cfauthenticate description authenticates a user, setting a security context for the application. For more information, see the descriptions of isauthenticated and authenticatedcontext . Category web application framework tags syntax username = "user_id" passwo...

  • Page 60

    42 chapter 2 coldfusion tags #cfcatch.Message# ....

  • Page 61

    Alphabetical list of coldfusion tags 43 cfbreak description used to break out of a cfloop . Category flow-control tags syntax see also cfabort , cfexecute , cfif/cfelseif/cfelse , cflocation , cfloop , cfswitch/ cfcase/cfdefaultcase , cfthrow , cftry cfcatch example select * from courses order by co...

  • Page 62

    44 chapter 2 coldfusion tags cfcache description speeds up page rendering when dynamic content does not have to be retrieved each time a user accesses the page. To accomplish this, cfcache creates temporary files that contain the static html returned from a coldfusion page. You can use cfcache for s...

  • Page 63

    Alphabetical list of coldfusion tags 45 usage to enable the simplest form of caching, you just code cfcache at the top of a page. With the action attribute, you can specify server-side caching, browser caching, or a combination of the two. The advantage of browser caching is that it takes no coldfus...

  • Page 64

    46 chapter 2 coldfusion tags the cfcache.Map file in a directory stores mappings for that directory only. If the timestamp of the underlying page changes, coldfusion updates the cache file for that url. Coldfusion uses the sourcetimestamp field to determine whether the currently cached file is up to...

  • Page 65

    Alphabetical list of coldfusion tags 47 cfcol description defines table column header, width, alignment, and text. Used only inside a cftable . Category data output tags syntax width = "number_indicating_width_of_column" align = "left" or "right" or "center" text = "double_quote_delimited_text_indic...

  • Page 66

    48 chapter 2 coldfusion tags htmltable> id" align = "left" width = 2 text = "#emp_id#"> name/email" align = "left" width = 15 text = "#firstname# #lastname#"> phone number" align = "center" width = 15 text = "#phone#"> htmltable> id" align = "left" width = 2 text = "#emp_id#"> name/email" align = "l...

  • Page 67

    Alphabetical list of coldfusion tags 49 cfcollection description allows you to create and administer verity collections. Category extensibility tags syntax "delete" or "optimize" or "map" collection = "collection_name" path = "path_of_verity_directory" language = "english" or "german" or "finnish" o...

  • Page 68

    50 chapter 2 coldfusion tags usage cfcollection works only at the collection level. To add content to a collection, use cfindex . Note the following regarding mapped collections: • mapping allows you to assign an alias to a verity collection created by a tool other than coldfusion. • the action , co...

  • Page 69

    Alphabetical list of coldfusion tags 51 collection = "#form.Collectionname#"> collection repaired. Collection = "#form.Collectionname#"> collection = "#form.Collectionname#"> collection optimized. Collection = "#form.Collectionname#"> collection = "#form.Collectionname#"> collection deleted. Collect...

  • Page 70

    52 chapter 2 coldfusion tags cfcontent description defines the mime type returned by the current page. Optionally, lets you specify the name of a file to be returned with the page. Category data output tags note in the coldfusion administrator, the security settings on the tag restrictions page unde...

  • Page 71

    Alphabetical list of coldfusion tags 53 file = "c:\inetpub\wwwroot\cfdocs\main.Htm" deletefile = "no"> file = "c:\inetpub\wwwroot\cfdocs\main.Htm" deletefile = "no"> cfcontent example 2 this example shows how the reset attribute changes the output for text. Reset = "yes ": 123456 p> this example sho...

  • Page 72

    54 chapter 2 coldfusion tags cfcookie description defines cookie variables, including expiration and security options. Category variable manipulation tags syntax value = "text" expires = "period" secure = "yes" or "no" path = "url" domain = ".Domain"> see also cfparam , cfregistry , cfsavecontent , ...

  • Page 73

    Alphabetical list of coldfusion tags 55 warning do not set a cookie variable on the same page that you use the cflocation tag. If you do, the cookie is never saved on the browser; therefore, it is of no value. Example select email, fromuser, subject, posted from comments cfcookie example value = "#n...

  • Page 74

    56 chapter 2 coldfusion tags the last aol visitor to view this site was #cookie.Lastaolvisitor#, on #dateformat(cookie.Timevisited)# hide my tracks no aol visitors have viewed the site lately..

  • Page 75

    Alphabetical list of coldfusion tags 57 cfdirectory description handles interactions with directories. Category file management tags note in the coldfusion administrator, the security settings on the tag restrictions page under coldfusion basic security may prevent cfdirectory from executing. In ord...

  • Page 76

    58 chapter 2 coldfusion tags usage when using the action = "list" , cfdirectory returns five result columns you can reference in your cfoutput : • name directory entry name. • size size of directory entry. • type file type: file for file or dir for directory. • datelastmodified date an entry was las...

  • Page 77

    Alphabetical list of coldfusion tags 59 ----------------------------------------------------------------------> cfdirectory example name = "mydirectory" sort = "name asc, size desc"> text = "#name#"> text = "#size#"> name = "mydirectory" sort = "name asc, size desc"> text = "#name#"> text = "#size#"...

  • Page 78

    60 chapter 2 coldfusion tags cfdump description o utputs variables for debugging purposes. Using cfdump , you can display the contents of simple variables, queries, arrays, structures, and wddx variables created with cfwddx . Category variable manipulation tags syntax see also cfcookie , cfdump , cf...

  • Page 79

    Alphabetical list of coldfusion tags 61 cferror description enables the display of customized html pages when errors occur. This lets you maintain a consistent look and feel within your application, even when errors occur. Category exception handling tags syntax "monitor" or "exception" template = "...

  • Page 80

    62 chapter 2 coldfusion tags templates the following table describes the template to use for each type of error. Error variables the exception-handling template specified in the template attribute of the cferror tag contains one or more error variables. Coldfusion substitutes the value of the error ...

  • Page 81

    Alphabetical list of coldfusion tags 63 the following table lists the error variables: note if you specify type = "exception" or type = "monitor" , you can substitute the prefix cferror for error ; for example, cferror.Diagnostics , cferror.Mailto , or cferror.Datetime . Example cferror provides the...

  • Page 82

    64 chapter 2 coldfusion tags handle your cf errors within a cf template than cferror, but cferror is still a good safeguard against general errors. You can also use cferror within the application.Cfm to specify error handling responsibilities for an entire application. Template = "request_err.Cfm" m...

  • Page 83

    Alphabetical list of coldfusion tags 65 cfexecute description enables coldfusion developers to execute a process on a server computer. Category extensibility tags syntax arguments = "commandline arguments" outputfile = "output file name" timeout = "timeout interval in seconds"> ... Arguments = "comm...

  • Page 84

    66 chapter 2 coldfusion tags usage cfexecute is available on windows nt 4.0 and unix platforms. Do not put other coldfusion tags or functions between the start and the end tags of cfexecute . The cfexecute tags cannot be nested. Exception cfexecute throws the following exceptions: • if the applicati...

  • Page 85

    Alphabetical list of coldfusion tags 67 cfexit description used to: • abort the processing of the currently executing cfml custom tag. • exit the template within the currently executing cfml custom tag • reexecute a section of code within the currently executing cfml custom tag category flow-control...

  • Page 86

    68 chapter 2 coldfusion tags example cfexit can be used to abort the processing of the currently executing cfml custom tag. Execution resumes following the invocation of the custom tag in the page that called the tag. Cfexit is used primarily to perform a conditional stop of processing inside a cust...

  • Page 87

    Alphabetical list of coldfusion tags 69 this text will not be executed due to the existence of the cfexit tag above it..

  • Page 88: Cffile Actions

    70 chapter 2 coldfusion tags cffile description handles all interactions with files. The attributes you use with cffile depend on the value of the action attribute. For example, if the action = "write" , use the attributes associated with writing a text file. Note in the coldfusion administrator, th...

  • Page 89

    Alphabetical list of coldfusion tags 71 cffile action = "upload" description uploads upload a file specified in a form field to a directory on the web server. Note the mode attribute applies only to coldfusion on solaris and hp-ux. Category file management tags syntax filefield = "formfield" destina...

  • Page 90

    72 chapter 2 coldfusion tags example the following example creates a unique filename if there is a name conflict when the file is uploaded on windows: filefield = "filecontents" destination = "c:\web\uploads\" accept = "text/html" nameconflict = "makeunique"> note on windows, you must include the ba...

  • Page 91

    Alphabetical list of coldfusion tags 73 note although the file prefix is still supported, it has been deprecated in favor of the cffile prefix. The following file upload status parameters are available after an upload. Parameter description attemptedserverfile initial name coldfusion used when attem...

  • Page 92

    74 chapter 2 coldfusion tags tip use the cffile prefix to refer to these parameters; for example, #cffile.Fileexisted# . Note file status parameters are read-only. They are set to the results of the most recent cffile operation. (if two cffile tags execute, the results of the first are overwritten b...

  • Page 93

    Alphabetical list of coldfusion tags 75 cffile action = "move" description moves a file from one location on the server to another. Category file management tags syntax source = "full_path_name" destination = "full_path_name" attributes = "file_attributes"> see also cfdirectory attributes example th...

  • Page 94

    76 chapter 2 coldfusion tags cffile action = "rename" description use cffile with the rename action to rename a file on the server. Category file management tags syntax source = "full_path_name" destination = "full_path_name" attributes = "file_attributes"> see also cfdirectory attributes example th...

  • Page 95

    Alphabetical list of coldfusion tags 77 cffile action = "copy" description copies a file from one directory to another on the server. Category file management tags syntax source = "full_path_name" destination = "full_path_name" attributes = "file_attributes"> see also cfdirectory attributes usage on...

  • Page 96

    78 chapter 2 coldfusion tags cffile action = "delete" description deletes a file on the server. Category file management tags syntax file = "full_path_name"> see also cfdirectory attributes example the following example deletes the specified file: file = "c:\files\upload\#variables.Deletefilename#">...

  • Page 97

    Alphabetical list of coldfusion tags 79 cffile action = "read" description reads a text file. The file is read into a dynamic parameter that you can use anywhere in the page, like any other dynamic parameter. For example, you could read a text file and then insert its contents into a database, or yo...

  • Page 98

    80 chapter 2 coldfusion tags cffile action = "readbinary" description read a binary file, such as an executable or image file. The file is read into a binary object parameter you can use anywhere in the page, like any other parameter. To send it through a web protocol, such as http or smtp, or store...

  • Page 99

    Alphabetical list of coldfusion tags 81 cffile action = "write" description writes a text file based on dynamic content. For example, you could create static html files from this content, or log actions in a text file. Category file management tags syntax file = "full_path_name" output = "content" m...

  • Page 100

    82 chapter 2 coldfusion tags example the following example creates a file with the information a user entered into an html insert form: file = "c:\files\updates\#form.Updatetitle#.Txt" output = "created by: #form.Fullname# date: #form.Date# #form.Content#"> if the user submitted a form with: updatet...

  • Page 101

    Alphabetical list of coldfusion tags 83 this example uploads a file and gives it the permissions owner/group/other = read/write/execute) . Cffile action = "upload" filefield = "fieldname" destination = "/tmp/program.Exe" mode = 777>.

  • Page 102: Cffile Action = "append"

    84 chapter 2 coldfusion tags cffile action = "append" description appends text to the end of an existing text file; for example, when creating log files. Category file management tags syntax file = "full_path_name" output = "string" attributes = "file_attributes"> see also cfdirectory attributes exa...

  • Page 103

    Alphabetical list of coldfusion tags 85 cfform description b uilds a form with cfml custom control tags that provide more functionality than standard html form input elements. Category forms tags note the cfform tag requires the client to download a java applet. Downloading an applet takes time, so ...

  • Page 104

    86 chapter 2 coldfusion tags usage coldfusion provides the following custom control tags: • cfinput creates a form input element (radio button, text box, or checkbox) and can validate form input • cfselect creates a drop down listbox • cfslider creates a slider control • cftextinput creates a text i...

  • Page 105

    Alphabetical list of coldfusion tags 87 • by placing html tags that can ordinarily be placed within the regular html form tag between and tags. For example, you use a standard html input tag to create a submit button in a cfform : example your radio button answer was yes your radio button answer was...

  • Page 106

    88 chapter 2 coldfusion tags no cfinput text boxes. (this item is optional) please enter a credit card number: message = "please enter a credit card number" validate = "creditcard" required = "no"> message = "please enter a credit card number" validate = "creditcard" required = "no"> rate your appro...

  • Page 107

    Alphabetical list of coldfusion tags 89 cfflush description flushes currently available data to the client. Category page processing tags syntax interval = integer number of bytes> see also cfcache , cfheader , cfinclude , cfsetting , cfsilent attributes usage the first time you use the cfflush tag ...

  • Page 108

    90 chapter 2 coldfusion tags page is slow to retrieve its first data, and in which additional information is generated slowly, and can be displayed incrementally. It will take us a little while to calculate your ten magic numbers. It takes a lot of work to find numbers that truly fit your personalit...

  • Page 109

    Alphabetical list of coldfusion tags 91 cfftp description lets users implement file transfer protocol (ftp) operations. Category internet protocol tags usage use the cfftp tag to move files between a coldfusion server and an ftp server. The cfftp tag cannot move files between a coldfusion server and...

  • Page 110

    92 chapter 2 coldfusion tags connecting to an ftp server description use the connection attribute of the cfftp tag to establish a connection with an ftp server. Category internet protocol tags syntax username = "name" password = "password" server = "server" timeout = "timeout in seconds" port = "por...

  • Page 111

    Alphabetical list of coldfusion tags 93 usage if you use connection caching to an active ftp connection, you do not have to respecify the connection attributes: • username • password • server changes to a cached connection, such as changing retrycount or timeout values, might require reestablishing ...

  • Page 112

    94 chapter 2 coldfusion tags server = "ftp.Tucows.Com" stoponerror = "yes"> did it succeed? #cfftp.Succeeded# list the files in a directory: stoponerror = "yes" name = "listfiles" directory = "/" connection = "my_query"> #name# close the connection: connection = "my_query" stoponerror = "yes"> did i...

  • Page 113

    Alphabetical list of coldfusion tags 95 cfftp: connection caching usage after you establish a connection with cfftp , you can reuse it to perform additional ftp operations. To do this, you use the connection attribute to define and name an ftp connection object that stores information about the conn...

  • Page 114

    96 chapter 2 coldfusion tags connection: file and directory operations description use this form of the cfftp tag to perform file and directory operations with cfftp . If you use connection caching to an active ftp connection, you do not have to respecify the connection attributes: • username • pass...

  • Page 115

    Alphabetical list of coldfusion tags 97 username required if the ftp connection is not cached. If connection caching is used, the username attribute is not required. User name to pass in the ftp operation. Name required for action = "listdir" . Specifies the query name to hold the directory listing....

  • Page 116

    98 chapter 2 coldfusion tags username required if the ftp connection is not cached. If connection caching is used, the username attribute is not required. User name to pass in the ftp operation. Name required for action = "listdir" . Specifies the query name to hold the directory listing. Server req...

  • Page 117

    Alphabetical list of coldfusion tags 99 usage when action = "listdir" , the attributes column returns directory or normal . Other platform-specific values, such as hidden and system , are no longer supported. When action = "listdir" , a mode column is returned. The column contains an octal string re...

  • Page 118

    100 chapter 2 coldfusion tags existsfile yes or no exists yes or no cfftp action value of cfftp.Returnvalue.

  • Page 119

    Alphabetical list of coldfusion tags 101 cfftp action = "listdir" description use the cfftp tag with the action attribute set to the value listdir to access the columns in a query object. Category internet protocol tags usage when you use cfftp with the listdir action, you must specify a value for t...

  • Page 120

    102 chapter 2 coldfusion tags cfgraph description displays a graphical representation of data. Category extensibility tags see also cfcollection , cfexecute , cfindex , cfobject , cfreport , cfsearch , cfservlet , cfwddx usage the cfgraph tag requires a terminating end tag, even if the tag body is e...

  • Page 121

    Alphabetical list of coldfusion tags 103 cfgraph type = "bar" or type = "horizontalbar" description use this form of the cfgraph tag to generate bar and horizontal bar graphs. Syntax query = "query name" valuecolumn = "query column" itemcolumn = "query column" url = "url string" urlcolumn = "query c...

  • Page 122

    104 chapter 2 coldfusion tags basic attributes these attributes provide basic information about the graph. Data drill-down attributes you can use the following attributes to make your chart active by linking to a url when the user clicks on a bar. Attribute description type required. Type of chart t...

  • Page 123

    Alphabetical list of coldfusion tags 105 bar chart value display attributes these attributes determine how data point values are displayed on the graph and the values on the vertical axes. Bar chart item label attributes these attributes determine how the item label information that describes each d...

  • Page 124

    106 chapter 2 coldfusion tags bar chart title attributes these attributes determine how the title and legend appear. Bar chart appearance attributes these attributes determine the general appearance of the graph. Itemlabelsize the size of the item labels, in points. Default is 12. Itemlabelorientati...

  • Page 125

    Alphabetical list of coldfusion tags 107 example the following example analyzes the salary data in the companyinfo database and generates a bar chart showing average salary by department. The body of the cfgraph tag includes one cfgraphdata tag to include data that is not available from the query. T...

  • Page 126

    108 chapter 2 coldfusion tags query = "datatable" valuecolumn = "avgsal" itemcolumn = "department_name" title = "average salary by deparment" scaleto = 120000 fileformat = "gif" depth = 5 colorlist = "red,green,blue,yellow,orange"> query = "datatable" valuecolumn = "avgsal" itemcolumn = "department_...

  • Page 127

    Alphabetical list of coldfusion tags 109 cfgraph type = "line" use this form of the cfgraph tag to generate line graphs and area graphs. An area graph is a line graph with the fill attribute set to "yes". Syntax query = "query name" valuecolumn = "query column" itemcolumn = "query column" scalefrom ...

  • Page 128

    110 chapter 2 coldfusion tags line graph value display attributes these attributes determine the values on the vertical axis. Line graph item label attributes these attributes determine how the item label information that describes each data point appears on the horizontal axis of the graph. Valueco...

  • Page 129

    Alphabetical list of coldfusion tags 111 line graph title attributes these attributes determine how the title appears on the graph. Line graph appearance attributes these attributes determine the general appearance of the graph. Attribute description title optional. Title to display centered above t...

  • Page 130

    112 chapter 2 coldfusion tags example the following example sets individual income values for the last four quarters. It creates an area graph to show the information. The graph uses cfgraphdata tags to specify the data points to chart. Title="quarterly income" fill="yes"> title="quarterly income" f...

  • Page 131

    Alphabetical list of coldfusion tags 113 cfgraph type = "pie" use this form of the cfgraph tag to generate pie charts. Syntax query = "query name" valuecolumn = "query column" itemcolumn = "query column" url = "url string" urlcolumn = "query column" showvaluelabel = "yes", "no", or "rollover" valuel...

  • Page 132

    114 chapter 2 coldfusion tags data drill-down attributes you can use the following attributes to make your chart active by linking to a url when the user clicks on a piece of pie. Pie chart value display attributes these attributes determine how the data point values are displayed on the graph and t...

  • Page 133

    Alphabetical list of coldfusion tags 115 pie chart legend and title attributes these attributes determine how the title and legend appear. Pie chart appearance attributes these attributes determine the general appearance of the graph. Valuelabelsize optional. The size the value text, in points. Defa...

  • Page 134

    116 chapter 2 coldfusion tags example the following example analyzes the salary data in the companyinfo database and generates a pie chart that shows total salaries by department. The chart uses the default file format, flash, which supports displaying the value labels as you roll over the pie slice...

  • Page 135

    Alphabetical list of coldfusion tags 117 query="datatable" valuecolumn="sumsal" itemcolumn="department_name" showvaluelabel="rollover" title="total salaries by department" colorlist="##6666ff,##66ff66,##ff6666,##66aaaa"> query="datatable" valuecolumn="sumsal" itemcolumn="department_name" showvaluela...

  • Page 136

    118 chapter 2 coldfusion tags cfgraphdata description specifies a data point to be displayed by a cfgraph tag. Category extensibility tags syntax value = data value item = "label string" color = "web color" url = "url string"> see also cfgraph , cfcollection , cfexecute , cfindex , cfobject , cfrepo...

  • Page 137

    Alphabetical list of coldfusion tags 119 cfgrid description used inside cfform , cfgrid lets you place a grid control in a coldfusion form. A grid control is a table of data divided into rows and columns. The cfgrid tag column data is specified with cfgridcolumn tags. Category forms tags syntax heig...

  • Page 138

    120 chapter 2 coldfusion tags notsupported = "text" picturebar = "yes" or "no" insertbutton = "text" deletebutton = "text" sortascendingbutton = "text" sortdescendingbutton = "text"> see also cfapplet , cfform , cfinput , cfselect , cfslider , cftextinput , cftree , cfgridcolumn , cfgridrow , cfgrid...

  • Page 139

    Alphabetical list of coldfusion tags 121 italic optional. Yes or no. Yes displays grid control text in italic. Default is no. Bold optional. Yes or no. Yes displays grid control text in boldface. Default is no. Textcolor optional. Color value for text in the grid control. Options are: black (default...

  • Page 140

    122 chapter 2 coldfusion tags rowheaders optional. Yes or no. Yes displays a column of numeric row labels in the grid control. Defaults to yes. Rowheaderalign optional. Enter left, right, or center to position data within a row header. Default is left. Rowheaderfont optional. Font to use for the row...

  • Page 141

    Alphabetical list of coldfusion tags 123 bgcolor optional. Background color value for the grid control. Entries are: black, magenta, cyan, orange, darkgray, pink, gray, white, lightgray, yellow. A hex value can be entered in the form: bgcolor = "##xxxxxx" where x is 0-9 or a-f. Use either two pound ...

  • Page 142

    124 chapter 2 coldfusion tags usage you can populate a cfgrid with data from a cfquery . If you do not specify any cfgridcolumn entries, a default set of columns is generated. Each column in the query is included in the default column list. In addition, a default header for each column is created by...

  • Page 143

    Alphabetical list of coldfusion tags 125 update data (selectmode = edit) if selectmode attribute is edit , the grid returns a great deal of data in order to inform the action page of any inserts, updates or deletes that the user has made to the grid. In most cases, you will not need to manually proc...

  • Page 144: Using The Href Attribute

    126 chapter 2 coldfusion tags form.#gridname#.#colname#: notset! Using the href attribute when specifying a url with grid items using the href attribute, the value of the selectmode attribute determines whether the appended key value is limited to a single grid item or it extends to a grid column or...

  • Page 145

    Alphabetical list of coldfusion tags 127 select course_id, dept_id, cornumber, corname, corlevel, cordesc from courselist order by dept_id asc, cornumber asc cfgrid example try adding a course to the database, and then deleting it. Query = "getcourses" insert = "yes" delete = "yes" sort = "yes" font...

  • Page 146

    128 chapter 2 coldfusion tags headeralign = "left" dataalign = "left" font = "times" bold = "no" italic = "no" select = "yes" display = "yes" headerbold = "no" headeritalic = "no"> headeralign = "left" dataalign = "left" bold = "no" italic = "no" select = "yes" display = "yes" headerbold = "no" head...

  • Page 147

    Alphabetical list of coldfusion tags 129 cfgridcolumn description used with cfgrid in a cfform , you use cfgridcolumn to specify column data in a cfgrid control. Font and alignment attributes used in cfgridcolumn override any global font or alignment settings defined in cfgrid . Category forms tags ...

  • Page 148

    130 chapter 2 coldfusion tags fontsize optional. Font size for text in the column. Default is the font specified by cfgrid . Italic optional. Yes or no. Yes displays all grid control text in italic. Default is as specified by the corresponding attribute of cfgrid . Bold optional. Yes or no. Yes disp...

  • Page 149

    Alphabetical list of coldfusion tags 131 href optional. Url to associate with the grid item. You can specify a url that is relative to the current page: ../mypage.Cfm or an absolute url: http://myserver.Com/mydir/mypage.Cfm hrefkey optional. The name of a query column when the grid uses a query. The...

  • Page 150

    132 chapter 2 coldfusion tags headerfontsize optional. Font size to use for the column header, in pixels. Default is as specified by the corresponding attribute of cfgrid . Headeritalic optional. Yes or no. Yes displays column header text in italic. Default is as specified by the corresponding attri...

  • Page 151

    Alphabetical list of coldfusion tags 133 using expressions in textcolor and bgcolor attributes the textcolor and bgcolor attributes accept a color value literal or an expression that lets you select a text color based on the evaluation of a simple boolean expression. The basic syntax for this expres...

  • Page 152

    134 chapter 2 coldfusion tags example ... Query = "getcourses" insert = "yes" delete = "yes" sort = "yes" font = "tahoma" bold = "no" italic = "no" appendkey = "no" highlighthref = "no" griddataalign = "left" gridlines = "yes" rowheaders = "yes" rowheaderalign = "left" rowheaderitalic = "no" rowhead...

  • Page 153

    Alphabetical list of coldfusion tags 135 headeritalic = "no"> headeralign = "left" dataalign = "left" bold = "no" italic = "no" select = "yes" display = "yes" headerbold = "no" headeritalic = "no"> ... Headeralign = "left" dataalign = "left" bold = "no" italic = "no" select = "yes" display = "yes" h...

  • Page 154

    136 chapter 2 coldfusion tags cfgridrow description lets you define a cfgrid that does not use a query as source for row data. If a query attribute is specified in cfgrid , the cfgridrow tags are ignored. Category forms tags syntax see also cfapplet , cfform , cfinput , cfselect , cfslider , cftexti...

  • Page 155

    Alphabetical list of coldfusion tags 137 cfgridupdate description used in a cfgrid , cfgridupdate allows you to perform updates to data sources directly from edited grid data. The cfgridupdate tag provides a direct interface with your data source. The cfgridupdate tag applies delete row actions firs...

  • Page 156

    138 chapter 2 coldfusion tags dbtype optional. The database driver type: • dynamic connect to an odbc data source that is not defined in the coldfusion administrator. When you use this attribute value, you must specify all the odbc connection information using the connectstring attribute. • odbc (de...

  • Page 157

    Alphabetical list of coldfusion tags 139 example ... Tablename = "courselist" keyonly = "yes"> ... Tableowner optional. For data sources that support table ownership (such as sql server, oracle, and sybase sql anywhere), use this field to specify the owner of the table. Tablequalifier optional. For ...

  • Page 158

    140 chapter 2 coldfusion tags cfheader description generates custom http response headers to return to the client. Category page processing tags syntax name = "header_name" value = "header_value"> or statuscode = "status_code" statustext = "status_text"> see also cfcache , cfflush , cfheader , cfhtm...

  • Page 159

    Alphabetical list of coldfusion tags 141 cfhtmlhead description cfhtmlhead writes the text specified in the text attribute to the generated html page. The cfhtmlhead tag can be useful for embedding javascript code, or placing other html tags such, as meta, link, title, or base in an html page header...

  • Page 160

    142 chapter 2 coldfusion tags cfhttp description lets you execute http post and get operations on files. Using cfhttp , you can execute standard get operations and create a query object from a text file. Post operations lets you upload mime file types to a server, or post cookie, formfield, url, fil...

  • Page 161

    Alphabetical list of coldfusion tags 143 password optional. When required by a server, a valid password. Name optional. The name to assign to a query if the a query is constructed from a file. Columns optional. Specifies the column names for a query when creating a query as a result of a cfhttp get....

  • Page 162

    144 chapter 2 coldfusion tags resolveurl optional. Yes or no. Default is no. For get and post operations, if yes, page reference returned into the filecontent internal variable has its internal urls fully resolved, including port number, so that links remain intact. The following html tags, which ca...

  • Page 163

    Alphabetical list of coldfusion tags 145 usage you must enable the timeout set in the coldfusion administrator in order for the coldfusion administrator timeout and the url timeout to take effect. This setting is on the coldfusion administrator server settings page. For more information, see advance...

  • Page 164

    146 chapter 2 coldfusion tags inserted into the query header. The query has all of the functionality of a standard cfquery object. • http post cfhttpparam tags can be nested inside a cfhttp tag in a post operation. The browser can be pointed to a url that specifies a cgi executable or a coldfusion p...

  • Page 165

    Alphabetical list of coldfusion tags 147 this example shows the ability of cfhttp to pull the contents of a web page from the internet, and shows how you can get the following information by using cfhttp variables: url = "http://www.Allaire.Com" resolveurl = 1 throwonerror = "yes" > url = "http://ww...

  • Page 166

    148 chapter 2 coldfusion tags cfhttpparam description required for cfhttp post operations, cfhttpparam is used to specify the parameters necessary to build a cfhttp post. Category internet protocol tags syntax type = "type" value = "transaction type" file = "filename"> see also cfftp , cfhttp , cfld...

  • Page 167

    Alphabetical list of coldfusion tags 149 form variable: ##form.Form_test## url variable: ##url.Url_test## cookie variable: ##cookie.Cookie_test## cgi variable: ##cgi.Cgi_test## ")#.

  • Page 168

    150 chapter 2 coldfusion tags cfif/cfelseif/cfelse description used with cfelse and cfelseif , cfif lets you create simple and compound conditional statements in cfml. The value in the cfif tag can be any expression. Category flow-control tags syntax html and cfml tags html and cfml tags html and cf...

  • Page 169

    Alphabetical list of coldfusion tags 151 if you want more than one condition to be the case, ask for a list of the centers in san diego or santa ana. If the center does not follow this condition, use cfelse to show only the names and cities of the other centers. Notice how a nested cfif is used to s...

  • Page 170

    152 chapter 2 coldfusion tags cfimpersonate description lets you impersonate a user defined in a security context that is defined in advanced security. Coldfusion server enforces the privileges and restrictions configured for the user with the advanced security rules. Category web application framew...

  • Page 171

    Alphabetical list of coldfusion tags 153 of the coldfusion administrator. Therefore, there is no need to make multiple isauthorized calls in the code to protect each resource. For more information, see advanced coldfusion administration. Example username = "bill" password = "bj4ye" type = "cf"> ... ...

  • Page 172

    154 chapter 2 coldfusion tags cfinclude description lets you embed references to coldfusion pages in cfml. You can embed cfinclude tags recursively. For an additional method of encapsulating cfml, see cfmodule on page 197 . Category page processing tags syntax see also cfcache , cfflush , cfheader ,...

  • Page 173

    Alphabetical list of coldfusion tags 155 cfindex description populates collections with indexed data. The cfindex and cfsearch tags encapsulate the verity indexing and searching utilities. Verity collections can be populated from text files in a directory you specify, or from a query generated by a ...

  • Page 174

    156 chapter 2 coldfusion tags type optional. Specifies the type of entity being indexed. Default is custom. Valid entries are: • file indexes files. • path indexes all files in specified path that pass extensions filter. • custom indexes custom entities from a coldfusion query. Title required if typ...

  • Page 175

    Alphabetical list of coldfusion tags 157 type optional. Specifies the type of entity being indexed. Default is custom. Valid entries are: • file indexes files. • path indexes all files in specified path that pass extensions filter. • custom indexes custom entities from a coldfusion query. Title requ...

  • Page 176

    158 chapter 2 coldfusion tags example cfindex example key = "c:\inetpub\wwwroot\cfdocs\snippets" type = "path" title = "test" urlpath = "http://127.0.0.1/cfdocs/snippets/" extensions = ".Cfm" recurse = "yes"> ... Recurse optional. Yes or no. Yes specifies, if type = "path" , that directories below t...

  • Page 177

    Alphabetical list of coldfusion tags 159 cfinput description used inside cfform to place radio buttons, checkboxes, or text boxes. Provides input validation for the specified control type. Category forms tags syntax name = "name" value = "initial_value" required = "yes" or "no" range = "min_value, m...

  • Page 178

    160 chapter 2 coldfusion tags validate optional. Valid entries are: • date verifies us date entry in the form mm/dd/yyyy. • eurodate verifies european date entry in the form dd/mm/yyyy. • time verifies a time entry in the form hh:mm:ss. • float verifies a floating point entry. • integer verifies an ...

  • Page 179

    Alphabetical list of coldfusion tags 161 usage you can add standard and dynamic html form tag attributes and values to the cfinput tag by using the passthrough attribute. They are passed through coldfusion to the browser in creating a form. If you specify a value in quotation marks, you must escape ...

  • Page 180

    162 chapter 2 coldfusion tags validate = "integer" required = "no"> date validation (enter a properly formatted date): a correctly formatted date (dd/mm/yy)" validate = "date" required = "no"> a correctly formatted date (dd/mm/yy)" validate = "date" required = "no">.

  • Page 181

    Alphabetical list of coldfusion tags 163 cfinsert description inserts records in data sources. Category database manipulation tags syntax dbtype = "type" dbserver = "dbms" dbname = "database name" tablename = "tbl_name" connectstring = "connection string" tableowner = "owner" tablequalifier = "tbl_q...

  • Page 182

    164 chapter 2 coldfusion tags example dbserver optional. For native database drivers and the sqloledb provider, specifies the name of the database server computer. If specified, dbserver overrides the server specified in the data source. Dbname optional. The database name (sybase system 11 driver an...

  • Page 183

    Alphabetical list of coldfusion tags 165 tablename = "comments" formfields = "email,fromuser,subject,messtext,posted"> select commentid, email, fromuser, subject, commttype, messtext, posted, processed from comments cfinsert example first, we’ll show a list of the available comments in the cfsnippet...

  • Page 184

    166 chapter 2 coldfusion tags cfoutput>">.

  • Page 185

    Alphabetical list of coldfusion tags 167 cfldap description provides an interface to ldap (lightweight directory access protocol) directory servers like the netscape directory server. For complete examples of cfldap usage, see developing coldfusion applications. Category internet protocol tags synta...

  • Page 186

    168 chapter 2 coldfusion tags action optional. Specifies the ldap action. Options : • query (default) returns ldap entry information only. Requires name , start , attributes attributes. See usage for more information. • add adds ldap entries to the ldap server. Requires attributes . • modify modifie...

  • Page 187

    Alphabetical list of coldfusion tags 169 filterfile optional. Specifies the name of a filter file and of the stanza tag within the file that contains the ldap filter string specification. You can specify an absolute pathname or a simple filename to identify the file. If you use a simple filename, cf...

  • Page 188

    170 chapter 2 coldfusion tags secure optional. Identifies the type of security to employ, cfssl_basic or cfssl_client_auth, and additional information that is required by the specified security type. Secure = "cfssl_basic,certificate_db" or secure = "cfssl_client_auth, certificate_db,certificate_nam...

  • Page 189

    Alphabetical list of coldfusion tags 171 usage if you use the query action , cfldap creates a query object, allowing access to information in the three query variables as described in the following table. The cfssl_basic type of security provides v2 ssl, and the cfssl_client_auth type of security pr...

  • Page 190

    172 chapter 2 coldfusion tags server = "ldap.Bigfoot.Com" action = "query" name = "results" start = "cn = #name#,c = us" filter = "(cn = #name#)" attributes = "cn,o,l,st,c,mail,telephonenumber" sort = "cn asc"> server = "ldap.Bigfoot.Com" action = "query" name = "results" start = "cn = #name#,c = us...

  • Page 191

    Alphabetical list of coldfusion tags 173 cflocation description opens a coldfusion page or html file. For example, you might use cflocation to specify a standard message or response that you use in several coldfusion applications. Use the addtoken attribute to verify client requests. Category flow-c...

  • Page 192

    174 chapter 2 coldfusion tags cflock description provides two types of locks to ensure the integrity of shared data: • exclusive lock • read-only lock an exclusive lock single-threads access to the cfml constructs in its body. Single-threaded access implies that the body of the tag can be executed b...

  • Page 193

    Alphabetical list of coldfusion tags 175 note limit the scope of code that updates shared data. Exclusive locks are required to ensure the integrity of these updates, but they have a significant impact on performance. Read-only locks are faster. If you have a performance-sensitive application, subst...

  • Page 194

    176 chapter 2 coldfusion tags in the coldfusion administrator, the locking page, under the server section, lets you set characteristics of the locking schema according to scope. The following table shows which features are available for server, application, and session scope. Each feature that you s...

  • Page 195

    Alphabetical list of coldfusion tags 177 occur. A deadlock is a state in which no request can execute the locked section of the page. All requests to the protected section of the page are blocked until there is a timeout. The following tables show two scenarios that cause deadlocks. The following de...

  • Page 196

    178 chapter 2 coldfusion tags note you can take out any pair of lock/unlock steps if you do not have to lock a scope. For example, you can take out steps 3 and 4 if you do not have to lock the server scope. Similar rules apply for named locks. For more information on cflock , see developing coldfusi...

  • Page 197

    Alphabetical list of coldfusion tags 179 cfapplication tag. ----------------------------------------------------------------------> e-turtleneck is proud to say that we have sold #application.Number# turtlenecks to date. Cflock example thank you for shopping e-turtleneck. Today you have chosen a tur...

  • Page 198

    180 chapter 2 coldfusion tags congratulations! You have just selected the longest wearing, most comfortable turtleneck in the world. Please indicate the color and size that you wish to buy. Red white blue turquoise black forest green xxsmall xsmall small medium large xlarge.

  • Page 199

    Alphabetical list of coldfusion tags 181 cflog description writes a message to a log file. Category data output tags syntax log = "log type" file = "filename" type = "message type" thread = "thread id yes or no" date = "date yes or no" time = "time yes or no" application = "application name yes or n...

  • Page 200

    182 chapter 2 coldfusion tags usage the cflog tag lets you log custom messages to standard or custom log files. You can specify a file for the log message or send messages to the default application or scheduler log. The log message can include coldfusion expressions. Log files must have the suffix ...

  • Page 201

    Alphabetical list of coldfusion tags 183 cfloop description looping is a very powerful programming technique that lets you repeat a set of instructions or display output repeatedly until one or more conditions are met. Cfloop supports five types of loops: • index loop on page 184 • conditional loop ...

  • Page 202

    184 chapter 2 coldfusion tags index loop description an index loop repeats for a number of times determined by a range of numeric values. Index loops are known as for loops, as in "loop for this range of values. " category flow-control tags syntax from = "beginning_value" to = "ending_value" step = ...

  • Page 203

    Alphabetical list of coldfusion tags 185 the result of this loop in a browser looks like this: the loop index is 1. The loop index is 2. The loop index is 3. The loop index is 4. The loop index is 5. Example 2 in this example, the index variable is incremented for each iteration of the loop. The fol...

  • Page 204

    186 chapter 2 coldfusion tags conditional loop description a conditional loop iterates over a set of instructions while a condition is true. To use this type of loop correctly, the instructions must change the condition every time the loop iterates until the condition evaluates as false. Conditional...

  • Page 205

    Alphabetical list of coldfusion tags 187 looping over a query description a loop over a query repeats for every record in the query record set. The cfloop results are just like a cfoutput . During each iteration of the loop, the columns of the current row are available for output. The cfloop tag let...

  • Page 206

    188 chapter 2 coldfusion tags example 3 the advantage of looping over a query is that you can use cfml tags that are not allowed in a cfoutput . The following example combines the pages that are returned by a query of a list of page names into one document, using the cfinclude tag. Datasource = "lib...

  • Page 207

    Alphabetical list of coldfusion tags 189 looping over a list description looping over a list lets you step through elements contained in a variable or value that is returned from an expression. In a list loop, the index attribute specifies the name of a variable to receive the next element of the li...

  • Page 208

    190 chapter 2 coldfusion tags looping over a com collection or structure description the cfloop collection attribute lets you loop over a structure or a com/dcom collection object: • a com/dcom collection object is a set of similar items referenced as a group rather than individually. For example, t...

  • Page 209

    Alphabetical list of coldfusion tags 191 ....

  • Page 210

    192 chapter 2 coldfusion tags cfmail description sends e-mail messages by an smtp server. Category internet protocol tags syntax from = "sender" cc = "copy_to" bcc = "blind_copy_to" subject = "msg_subject" type = "msg_type" maxrows = "max_msgs" mimeattach = "path" query = "query_name" group = "query...

  • Page 211

    Alphabetical list of coldfusion tags 193 example type optional. Specifies extended type attributes for the message. Currently, the only valid value for this attribute is "html". Specifying type = "html" informs the receiving e-mail client that the message has embedded html tags to be processed. This...

  • Page 212

    194 chapter 2 coldfusion tags this view-only example shows the use of cfmail. If your cfas mail settings are configured successfully and the comments are removed, you will be able to use this code to send simple e-mail. A recipient for this message"> enter a sender for this message"> a subject for t...

  • Page 213

    Alphabetical list of coldfusion tags 195 cfmailparam description can either attach a file or add a header to a message. It is nested within a cfmail tag. You can use more than one cfmailparam tag within a cfmail tag. Category internet protocol tags syntax to = "recipient" subject = "msg_subject" fro...

  • Page 214

    196 chapter 2 coldfusion tags you think..

  • Page 215

    Alphabetical list of coldfusion tags 197 cfmodule description invokes a custom tag for use in coldfusion application pages. The cfmodule tag can help deal with custom tag name conflicts. Use the template attribute to name a coldfusion page that contains the custom tag definition, including its path....

  • Page 216

    198 chapter 2 coldfusion tags likewise, if the custom tag uses a cfassociate tag to save its attributes, the attributes passed with attributecollection are saved as independent attribute values with no indication that the attributes are grouped into a structure by the custom tag’s caller. Example th...

  • Page 217

    Alphabetical list of coldfusion tags 199 x = 3 attributecollection = ##attrcollection1## y = 4>")# the result: #result# name = "mytag" x = "3" attributecollection = #attrcollection1# y = "4"> here is another way to invoke the custom tag, using the name attribute. Name = "mytag" x = "3" attributecoll...

  • Page 218: Cfobject Types

    200 chapter 2 coldfusion tags cfobject description lets you call methods in com, corba, and java objects. Note coldfusion administrators can disable the cfobject tag using the tag restrictions page under coldfusion basic security. On unix, cfobject does not support com objects. Cfobject types • cfob...

  • Page 219

    Alphabetical list of coldfusion tags 201 cfobject type = "com" description lets you create and use component object model (com) objects. With this tag, you can invoke any automation server object type registered on a computer. You can use a utility like microsoft’s oleview to browse com objects. Ole...

  • Page 220

    202 chapter 2 coldfusion tags type = "com" class = allaire.Docex1.1 name = "obj"> this object has #obj.Count# items. Type = "com" class = allaire.Docex1.1 name = "obj"> this object has #obj.Count# items. The last name in the third item is #emp.Lastname#. Looping through all items in the collection: ...

  • Page 221

    Alphabetical list of coldfusion tags 203 cfobject type = "corba" description lets you call methods in corba objects. These objects must be defined and registered for use. Category extensibility tags syntax context = "context" class = "file or naming service" name = "text" locale = "type-value argume...

  • Page 222

    204 chapter 2 coldfusion tags example context = "ior" class = "c:\\myobject.Ior" name = "getname"> context = "ior" class = "c:\\myobject.Ior" name = "getname">.

  • Page 223

    Alphabetical list of coldfusion tags 205 cfobject type = "java" description lets you create and use java objects, and by extension ejb objects. Category extensibility tags syntax action = "create" type = "java" class = "java class" name = "object name"> see also cfcollection , cfexecute , cfgraph , ...

  • Page 224

    206 chapter 2 coldfusion tags example 1 action = "create" type = "java" class = "myclass" name = "myobj"> example 2 action = "create" type = "java" class = "weblogic/jndi/environment" name = "wlenv"> share value = #value# action = "create" type = "java" class = "myclass" name = "myobj"> example 2 ac...

  • Page 225

    Alphabetical list of coldfusion tags 207 cfoutput description displays the results of a database query or other operation. To nest cfoutput tags, see the "usage" section. Category data output tags syntax query = "query_name" group = "query_column" groupcasesensitive = "yes" or "no" startrow = "start...

  • Page 226

    208 chapter 2 coldfusion tags select dept_id, corname, corlevel from courselist order by dept_id, corlevel, corname cfoutput simply tells coldfusion server to begin processing, and then to hand back control of page rendering to the web server. For example, to show today’s date, you could write #date...

  • Page 227

    Alphabetical list of coldfusion tags 209 cfparam description tests for a parameter’s existence, tests its data type, and provides a default value if one is not assigned. Category variable manipulation tags syntax type = "data_type"> default = "value"> see also cfcookie , cfregistry , cfsavecontent ,...

  • Page 228

    210 chapter 2 coldfusion tags continues and the value is not changed. If the variable does not exist, it is created and set to the value of the default attribute. Example cfparam example cfparam is used to set default values so that the developer does not must check for the existence of a variable u...

  • Page 229

    Alphabetical list of coldfusion tags 211 cfpop description retrieves and deletes e-mail messages from a pop mail server. Category internet protocol tags syntax port = "port_number" username = "username" password = "password" action = "action" name = "queryname" messagenumber = "number" attachmentpat...

  • Page 230

    212 chapter 2 coldfusion tags usage note two retrieve options are offered to maximize performance. Message header information is typically short and therefore quick to transfer. Message text and attachments can be very long and therefore take longer to process. See the message header and body column...

  • Page 231

    Alphabetical list of coldfusion tags 213 message header and body columns the following table lists the message header and body columns returned by cfpop when you specify the action attribute as either getheaderonly or getall . To create a coldfusion date/time object from the date-time string that is...

  • Page 232

    214 chapter 2 coldfusion tags simply uncomment this code and run with a mail-enabled cf server to see this feature in action. Action = "getheaderonly " name = "getheaders "> message headers in your inbox action = "getheaderonly " name = "getheaders "> number of records: #getheaders.Recordcount# ente...

  • Page 233

    Alphabetical list of coldfusion tags 215 cfprocessingdirective description suppresses extra white space and other output, produced by cfml within the tag’s scope. Category data output tags syntax suppresswhitespace = "yes" or "no"> … any cfml tags here … suppresswhitespace = "yes" or "no"> … any cfm...

  • Page 234

    216 chapter 2 coldfusion tags cfprocparam description specifies parameter information, including type, name, value, and length. The cfprocparam tag is nested within a cfstoredproc tag. Category database manipulation tags syntax variable = "variable name" dbvarname = "db variable name" value = "param...

  • Page 235

    Alphabetical list of coldfusion tags 217 usage use this tag to identify stored procedure parameters and their data types. Code one cfprocparam tag for each parameter. The parameters you code vary based on parameter type and dbms. The order in which you code cfprocparam tags matters, depending on whe...

  • Page 236

    218 chapter 2 coldfusion tags example this example shows an oracle 8 pl/sql stored procedure, and the cfml code used to invoke it. It makes use of oracle 8’s support of the reference cursor type. The following package foo_data houses a procedure refcurproc that declares two output parameters as refe...

  • Page 237

    Alphabetical list of coldfusion tags 219 the first result set: the second result set: the output parameter is:’#foo#’.

  • Page 238

    220 chapter 2 coldfusion tags cfprocresult description specifies a result set name that other coldfusion tags, such as cfoutput and cftable , use to access the result set. It also lets you optionally identify which of the stored procedure’s result sets to return. The cfprocresult tag is nested withi...

  • Page 239

    Alphabetical list of coldfusion tags 221 the output param value: ’#foo#’ #name#,#date_col# record count: #rs1.Recordcount# >p>columns: #rs1.Columnlist# #col1#,#col2#,#col3# record count: #rs3.Recordcount# columns: #rs3.Columnlist# the return code for the stored procedure is: ’#cfstoredproc.Statuscod...

  • Page 240

    222 chapter 2 coldfusion tags cfquery description passes sql statements to a data source. Not limited to queries. Category database manipulation tags syntax datasource = "ds_name" dbtype = "type" dbserver = "dbms" dbname = "database name" connectstring = "connection string" username = "username" pas...

  • Page 241

    Alphabetical list of coldfusion tags 223 dbtype optional. The database driver type: • dynamic connect to an odbc data source that is not defined in the coldfusion administrator. When you use this attribute value, you must specify all the odbc connection information using the connectstring attribute....

  • Page 242

    224 chapter 2 coldfusion tags dbtype optional. The database driver type: • dynamic connect to an odbc data source that is not defined in the coldfusion administrator. When you use this attribute value, you must specify all the odbc connection information using the connectstring attribute. • query us...

  • Page 243

    Alphabetical list of coldfusion tags 225 maxrows optional. Specifies the maximum number of rows to return in the record set. The maxrows attribute accepts an argument of -1 , which causes cfquery to return all rows in the query object. Blockfactor optional. Specifies the maximum number of rows to fe...

  • Page 244

    226 chapter 2 coldfusion tags usage in addition to returning data from a coldfusion data source, the cfquery tag also returns information about the query. Cfquery.Executiontime returns the time it took the query to execute in milliseconds. The cfquery tag creates a query object, providing informatio...

  • Page 245

    Alphabetical list of coldfusion tags 227 "#maxrows#"> #getparks.Currentrow# #parkname# #region# #state# "#maxrows#"> #getparks.Currentrow# #parkname# #region# #state# #evaluate(startrow + maxrows)#">see next #maxrows# rows.

  • Page 246

    228 chapter 2 coldfusion tags cfqueryparam description checks the data type of a query parameter. The cfqueryparam tag is nested within a cfquery tag. It is embedded within the query sql statement. If you specify its optional parameters, cfqueryparam also performs data validation. Category database ...

  • Page 247

    Alphabetical list of coldfusion tags 229 attributes attribute description value required. Specifies the actual value that coldfusion passes to the right of the comparison operator in a where clause. Cfsqltype optional. The sql type that the parameter (any type) will be bound to. The default value is...

  • Page 248

    230 chapter 2 coldfusion tags usage note for data, you must specify the maxlength attribute to ensure that maximum length validation is enforced. The cfqueryparam tag does the following: • allows the use of sql bind parameters • allows long text fields to be updated from an sql statement • improves ...

  • Page 249

    Alphabetical list of coldfusion tags 231 select * from courses where course_id = cfsqltype = "cf_sql_integer"> course number: #course_num# description: #descript# cfsqltype = "cf_sql_integer"> course number: #course_num# description: #descript# select * from courses where course_id = cfsqltype = "cf...

  • Page 250

    232 chapter 2 coldfusion tags ’peterson’"> for string input, specify the maxlength attribute for validation. ----------------------------------------------------------------------> select * from employees where lastname = cfsqltype = "cf_sql_varchar" maxlength = "17"> course number: #firstname# #las...

  • Page 251: Cfregistry Actions

    Alphabetical list of coldfusion tags 233 cfregistry description reads, writes, and deletes keys and values in the system registry. The cfregistry tag is supported on all platforms, including linux, solaris, and hp-ux. Note in the coldfusion administrator, the security settings on the tag restriction...

  • Page 252

    234 chapter 2 coldfusion tags cfregistry action = "getall" description used with the getall action to return all registry keys and values defined in a branch. You can access the values as you would any record set. Category variable manipulation tags syntax branch = "branch" type = "data type" name =...

  • Page 253

    Alphabetical list of coldfusion tags 235 branch = "hkey_local_machine\software\microsoft\java vm" type = "any" name = "regquery"> entry" width = "35" text = "#regquery.Entry#"> type" width = "10" text = "#regquery.Type#"> value" width = "35" text = "#regquery.Value#">.

  • Page 254

    236 chapter 2 coldfusion tags cfregistry action = "get" description used with the get action to access a registry value and store it in a coldfusion variable. Category variable manipulation tags syntax branch = "branch" entry = "key or value" variable = "variable" type = "data type"> see also cfcook...

  • Page 255

    Alphabetical list of coldfusion tags 237 cfregistry action = "set" description used with the set action to add a registry key, add a new value, or update value data. Category variable manipulation tags syntax branch = "branch" entry = "key or value" type = "value type" value = "data"> see also cfcoo...

  • Page 256

    238 chapter 2 coldfusion tags cfregistry action = "delete" description used with the delete action to delete a registry key or value. Category variable manipulation tags syntax branch = "branch" entry = "keyorvalue"> see also cfcookie , cfparam , cfsavecontent , cfschedule , cfset attributes usage i...

  • Page 257

    Alphabetical list of coldfusion tags 239 cfreport description runs a predefined crystal reports report. Category extensibility tags syntax orderby = "result_order" username = "username" password = "password" formula = "formula"> orderby = "result_order" username = "username" password = "password" fo...

  • Page 258

    240 chapter 2 coldfusion tags this example would run a report called "monthlysales.Rpt " and pass it an optional filter condition to show only the information for a certain subset of the report. {departments.Department} = ‘international’ substitute your own report files and filters for this code and...

  • Page 259

    Alphabetical list of coldfusion tags 241 cfrethrow description rethrows the currently active exception. Preserves the exception’s cfcatch . Type and cfcatch.Tagcontext information. Category exception handling tags syntax see also cferror , cfthrow , cftry cfcatch usage use the cfrethrow tag within a...

  • Page 260

    242 chapter 2 coldfusion tags #c# = #cfcatch[c]#.

  • Page 261

    Alphabetical list of coldfusion tags 243 cfsavecontent description saves the generated content inside the tag body in a variable. Category variable manipulation tags syntax content see also cfcookie , cfparam , cfregistry , cfschedule , cfset attributes usage this tag saves everything in the body of...

  • Page 262

    244 chapter 2 coldfusion tags cfschedule description provides a programmatic interface to the coldfusion scheduling engine. You can run a specified page at scheduled intervals with the option to write out static html pages. This lets you offer users access to pages that publish data, such as reports...

  • Page 263

    Alphabetical list of coldfusion tags 245 attributes attribute description action required. Valid entries are: • delete – deletes task specified by task • update – creates a task if one does not exist • run – executes task specified by task task required. The name of the task to delete, update, or ru...

  • Page 264

    246 chapter 2 coldfusion tags usage you cannot use cfschedule and apply the secure sockets layer (ssl) to an application. Example cfschedule provides a programmatic interface to the coldfusion scheduling engine. You can run a specified page at scheduled intervals with the option to write out static ...

  • Page 265

    Alphabetical list of coldfusion tags 247 cfscript description encloses a code segment containing cfscript . Category web application framework tags syntax cfscript code goes here see also cfapplication , cflock , cfassociate , cfmodule , cfauthenticate , cfimpersonate usage use cfscript to perform p...

  • Page 266

    248 chapter 2 coldfusion tags twice #x# is #z#. Your string value was: #stringvar# ....

  • Page 267

    Alphabetical list of coldfusion tags 249 cfsearch description executes searches against data indexed in verity collections. Collections can be created by calling the cfcollection tag, by using the coldfusion administrator, or through native verity indexing tools. Collections are populated with data ...

  • Page 268

    250 chapter 2 coldfusion tags usage in the criteria attribute, if you pass a mixed case entry, case sensitivity is applied to the search. If you pass all upper or all lower case, case insensitivity is assumed. Every search conducted with the cfsearch tag returns, as part of the record set, a number ...

  • Page 269

    Alphabetical list of coldfusion tags 251 you can use these result columns in standard cfml expressions, preceding the result column name with the name of the query: #docsearch.Url# #docsearch.Key# #docsearch.Title# #docsearch.Score# example cfsearch example collection = "#form.Source#" type = "#form...

  • Page 270

    252 chapter 2 coldfusion tags #searchsnippets.Recordcount# "hit s" found out of #searchsnippets.Recordssearched# total record s searched. #form.Maxrows# records returned ... Startrow = "1" colheaders htmltable> text = "#title#"> startrow = "1" colheaders htmltable> text = "#title#"> text = "#title#"...

  • Page 271

    Alphabetical list of coldfusion tags 253 cfselect description used inside cfform , cfselect lets you construct a drop-down list box form control. You can populate the drop-down list box from a query, or using the option tag. Use option elements to populate lists. The syntax for the option tag is the...

  • Page 272

    254 chapter 2 coldfusion tags usage note the cfselect tag requires the client to download a java applet. This takes time, so using cfselect may be slightly slower than using a select element within an html form tag. For cfselect to work properly, browsers must be java-enabled. You can add standard a...

  • Page 273

    Alphabetical list of coldfusion tags 255 cfselect example this employee" to see expanded information. Size = "#getemployees.Recordcount#" query = "getemployees" value = "lastname" required = "no"> select all size = "#getemployees.Recordcount#" query = "getemployees" value = "lastname" required = "no...

  • Page 274

    256 chapter 2 coldfusion tags cfservlet description executes a java servlet on a jrun engine. This tag is used in conjunction with the cfserletparam tag, which passes data to the servlet. Category java servlet and java object tags syntax jrunproxy = "proxy server" timeout = "timeout in seconds" writ...

  • Page 275

    Alphabetical list of coldfusion tags 257 usage the syntax of the cfservlet tag is consistent with the html markup servlet and param tags used by some web servers to invoke java servlets from .Shtml pages in server-side includes (ssi). The servlet must exist somewhere in the class path of the jrun en...

  • Page 276

    258 chapter 2 coldfusion tags cfservletparam description a child of cfservlet . It passes data to the servlet. Each cfservletparam tag within the cfservlet block passes a separate piece of data to the servlet. Category java servlet and java object tags syntax ...> value = "servlet parameter value"> ...

  • Page 277

    Alphabetical list of coldfusion tags 259 reference to the servlet. Within the servlet, the variable data is made available as servlet attributes in the form of java objects. On the java side, the data can be manipulated, or changed, changing the value of the associated coldfusion variable. When used...

  • Page 278

    260 chapter 2 coldfusion tags cfset description define a coldfusion variable. If the variable exists, cfset resets it to the specified value. Category variable manipulation tags syntax see also cfcookie , cfparam , cfregistry , cfsavecontent , cfschedule usage arrays the following example assigns a ...

  • Page 279

    Alphabetical list of coldfusion tags 261 example select * from messages cfset example cfset allows you to set and reassign values to local or global variables within a cf template. For example, the variable numrecords has been declared on this template to hold the amount of records returned from our...

  • Page 280

    262 chapter 2 coldfusion tags cfsetting description controls various aspects of page processing, such as the output of html code in pages. One benefit of this option is managing whitespace that can occur in output pages served by coldfusion. Category page processing tags syntax showdebugoutput = "ye...

  • Page 281

    Alphabetical list of coldfusion tags 263 text within cfoutput is always shown text within cfoutput is always shown.

  • Page 282

    264 chapter 2 coldfusion tags cfsilent description suppresses all output that is produced by the cfml within the tag’s scope. Category page processing tags syntax see also cfcache , cfflush , cfheader , cfhtmlhead , cfinclude , cfsetting example #c# ... Even information within cfoutput tags does not...

  • Page 283

    Alphabetical list of coldfusion tags 265 cfslider description used inside cfform , cfslider lets you place a slider control in a coldfusion form. A slider control is like a sliding volume control. The slider groove is the area over which the slider moves. Category forms tags syntax label = "text" re...

  • Page 284

    266 chapter 2 coldfusion tags refreshlabel optional. Yes or no. If yes, the label is not refreshed when the slider is moved. Default is yes. Img this attribute has been deprecated and is non-functional. Imgstyle this attribute has been deprecated and is non-functional. Range optional. The values of ...

  • Page 285

    Alphabetical list of coldfusion tags 267 tickmarkmajor optional. Yes to render major tickmarks in the slider scale. No for no major tickmarks. Default is no. Major tick marks are the marks that appear at the intervals specified by the scale attribute. Tickmarkminor optional. Yes to render minor tick...

  • Page 286

    268 chapter 2 coldfusion tags usage cfslider requires the client to download a java applet. This takes time; therefore, using cfslider may be slightly slower than using an html form element to retrieve or display the same information. Browsers must be java-enabled for cfslider to work properly. Note...

  • Page 287

    Alphabetical list of coldfusion tags 269 try again! 1 " range = "1,100" align = "baseline" message = "slide the bar to get a value between 1 and 100" height = "20" width = "150" font = "verdana" bgcolor = "silver" groovecolor = "lime" bold = "no" italic = "yes" refreshlabel = "yes"> 100

  • Page 288

    270 chapter 2 coldfusion tags cfstoredproc description executes stored procedures by an odbc or native connection to a server database. It specifies database connection information and identifies the stored procedure. Category database manipulation tags syntax datasource = "ds_name" dbtype = "type" ...

  • Page 289

    Alphabetical list of coldfusion tags 271 dbtype optional. The database driver type: • dynamic connect to an odbc data source that is not defined in the coldfusion administrator. When you use this attribute value, you must specify all the odbc connection information using the connectstring attribute....

  • Page 290

    272 chapter 2 coldfusion tags usage within a cfstoredproc tag, you code cfprocresult and cfprocparam tags as necessary. If you set the returncode parameter to "yes", cfstoredproc sets a variable called cfstoredproc . Statuscode , which indicates the status code for the stored procedure. Stored proce...

  • Page 291

    Alphabetical list of coldfusion tags 273 the output param value: ’#foo#’ #name#,#date_col# record count: #rs1.Recordcount# >p>columns: #rs1.Columnlist# #col1#,#col2#,#col3# record count: #rs3.Recordcount# columns: #rs3.Columnlist# the return code for the stored procedure is: ’#cfstoredproc.Statuscod...

  • Page 292

    274 chapter 2 coldfusion tags cfswitch/cfcase/cfdefaultcase description used with cfcase and cfdefaultcase . Evaluates a passed expression and passes control to the cfcase tag that matches the expression result. You can optionally code a cfdefaultcase tag, which receives control if there is no match...

  • Page 293

    Alphabetical list of coldfusion tags 275 select emp_id, firstname, lastname, email, phone, department from employees cfswitch example #firstname# #lastname# is in sales #firstname# #lastname# is in accounting #firstname# #lastname# is in administration #firstname# #lastname# is not in sales, account...

  • Page 294

    276 chapter 2 coldfusion tags cftable description builds a table in a coldfusion page. Use the cfcol tag to define table column and row characteristics. The cftable tag renders data either as preformatted text, or, with the htmltable attribute, as an html table. Use cftable to create tables if you d...

  • Page 295

    Alphabetical list of coldfusion tags 277 select emp_id, firstname, lastname, email, phone, department from employees htmltable> id" align = "left" width = 2 text = "#emp_id#"> name/email" align = "left" width = 15 text = "#firstname# #lastname#"> phone number" align = "center" width = 15 text = "#ph...

  • Page 296

    278 chapter 2 coldfusion tags cftextinput description lets you place a single-line text entry box in a cfform . The tag also gives you control over font characteristics. Category forms tags syntax value = "text" required = "yes" or "no" range = "min_value, max_value" validate = "data_type" onvalidat...

  • Page 297

    Alphabetical list of coldfusion tags 279 validate optional. Valid entries are: • date verifies us date entry in the form mm/dd/yy. • eurodate verifies valid european date entry in the form dd/mm/ yyyy. • time verifies a time entry in the form hh:mm:ss. • float verifies a floating point entry. • inte...

  • Page 298

    280 chapter 2 coldfusion tags usage note cftextinput requires the client to download a java applet. Downloading an applet takes time; therefore, using cftextinput might be slightly slower than using an html form element to retrieve the same information. In addition, browsers must be java-enabled for...

  • Page 299

    Alphabetical list of coldfusion tags 281 example cftextinput example cftextinput can be used to provide simple validation for text fields in cfform and to have control over font information displayed in cfform input boxes for text. For example, the field provided below must not be blank, and provide...

  • Page 300

    282 chapter 2 coldfusion tags cfthrow description the cfthrow tag raises a developer-specified exception that can be caught with cfcatch tag having any of the following type specifications: • cfcatch type = "custom_type" • cfcatch type = "application" • cfcatch type = "any" category exception handli...

  • Page 301

    Alphabetical list of coldfusion tags 283 example cfthrow example #cfcatch.Message# the contents of the tag stack are: #i# #scurrent["id"]# (#scurrent["line"]#,#scurrent["column"]#) #scurrent["template"]#.

  • Page 302

    284 chapter 2 coldfusion tags cftransaction description groups multiple queries into a single unit. The cftransaction tag provides commit and rollback processing. See usage for details. Category database manipulation tags syntax action = "begin" or "commit" or "rollback" isolation = "read_uncommitte...

  • Page 303

    Alphabetical list of coldfusion tags 285 example cftransaction can be used to group multiple queries using cfquery into a single business event. Changes to data requested by these queries can be committed on the basis of the success or failure of the query by using the actions commit and rollback, r...

  • Page 304

    286 chapter 2 coldfusion tags insert into courselist (cornumber, cordesc, dept_id, corname, corlevel, lastupdate) values (’#mynumber#’, ’#mydescription#’, ’#mydepartment#’, ’#mydescription#’, ’#mycorlevel#’, #now()#).

  • Page 305

    Alphabetical list of coldfusion tags 287 cftree description lets you put a tree control in a cfform . Validates user selections. Tree items are created with cftreeitem tags inside the cftree tag block. You can use a coldfusion query to supply data to the tree. Category forms tags syntax required = "...

  • Page 306

    288 chapter 2 coldfusion tags appendkey optional. Yes or no. When used with href , yes passes the cftreeitemkey variable along with the value of the selected tree item in the url to the application page specified in the cfform action attribute. The default is yes. Highlighthref optional. Yes highlig...

  • Page 307

    Alphabetical list of coldfusion tags 289 usage note the cftree tag requires the client to download a java applet. Downloading an applet takes time; therefore, using cftree may be slightly slower than using an html form element to retrieve the same information. In addition, browsers must be java-enab...

  • Page 308

    290 chapter 2 coldfusion tags = ’#employeenames#’ cftree example this employee" to see expanded information. Size = "#getemployees.Recordcount#" query = "getemployees" value = "lastname" required = "no"> select all size = "#getemployees.Recordcount#" query = "getemployees" value = "lastname" require...

  • Page 309

    Alphabetical list of coldfusion tags 291 parent = "#emp_id#" queryasroot = "no" expand = "no"> expand = "no" queryasroot = "no"> queryasroot = "no" expand = "no"> queryasroot = "no"> ... Parent = "#emp_id#" queryasroot = "no" expand = "no"> expand = "no" queryasroot = "no"> queryasroot = "no" expand...

  • Page 310

    292 chapter 2 coldfusion tags cftreeitem description populates a tree control, created with cftree , with elements. You can use the img values supplied with coldfusion or reference your own icons. Category forms tags syntax display = "text" parent = "parent_name" img = "filename" imgopen = "filename...

  • Page 311

    Alphabetical list of coldfusion tags 293 img optional. Image name or filename for the tree item. When populating a cftree with data from a cfquery , images or filenames for each level of the tree are specified in a comma-separated list. The default image name is "folder. " the following images are s...

  • Page 312

    294 chapter 2 coldfusion tags usage note the cftreeitem tag incorporates a java applet. For cftree to work properly, a browser must be java-enabled. Example select emp_id, firstname, lastname, email, phone, department from employees where lastname = ’#employeenames#’ cftree example queryasroot optio...

  • Page 313

    Alphabetical list of coldfusion tags 295 this employee" to see expanded information. Size = "#getemployees.Recordcount#" query = "getemployees" value = "lastname" required = "no"> select all size = "#getemployees.Recordcount#" query = "getemployees" value = "lastname" required = "no"> select all val...

  • Page 314

    296 chapter 2 coldfusion tags cftry cfcatch description used with one or more cfcatch tags, the cftry tag lets you catch and process exceptions in coldfusion pages. Exceptions include events that disrupt the normal flow of instructions in a coldfusion page, such as failed database operations, missin...

  • Page 315

    Alphabetical list of coldfusion tags 297 applications can optionally use the cfthrow tag to raise custom exceptions. Such exceptions are caught with any of the following type specifications: • type = "custom_type" • type = "application" • type = "any" the custom_type type designates the name of a us...

  • Page 316

    298 chapter 2 coldfusion tags • sqlstate type = "database" only. The sqlstate associated with this exception. Database drivers typically provide error codes to assist diagnosis of failing database operations. If no sqlstate value was provided, the value of sqlstate is -1. • errnumber type = "express...

  • Page 317

    Alphabetical list of coldfusion tags 299 com.Allaire.Coldfusion.Httpgatewaytimeout com.Allaire.Coldfusion.Httpgone com.Allaire.Coldfusion.Httpmethodnotallowed com.Allaire.Coldfusion.Httpmovedpermanently com.Allaire.Coldfusion.Httpmovedtemporarily com.Allaire.Coldfusion.Httpmultiplechoices com.Allair...

  • Page 318

    300 chapter 2 coldfusion tags note to see the tag stack displayed by tagcontext, use the coldfusion administrator to enable the cfml stack trace. Under debugging in the coldfusion administrator, select the checkbox next to "enable cfml stack trace. " example select * from employeeas ... Other proces...

  • Page 319

    Alphabetical list of coldfusion tags 301 cfupdate description updates existing records in data sources. Category database manipulation tags syntax dbtype = "type" dbserver = "dbms" dbname = "database name" connectstring = "connection string" tablename = "table_name" tableowner = "name" tablequalifie...

  • Page 320

    302 chapter 2 coldfusion tags example dbserver optional. For native database drivers and the sqloledb provider, specifies the name of the database server computer. If specified, dbserver overrides the server specified in the data source. Dbname optional. The database name (sybase system 11 driver an...

  • Page 321

    Alphabetical list of coldfusion tags 303 tablename = "courses" formfields = "course_id,course_num,descript"> select course_num, course_id, descript from courses where course_id = #url.Course_id# order by course_num tablename = "courses" formfields = "course_id,course_num,descript"> select course_num...

  • Page 322

    304 chapter 2 coldfusion tags.

  • Page 323

    Alphabetical list of coldfusion tags 305 cfwddx description serializes and de-serializes cfml data structures to the xml-based wddx format. Generates javascript statements to instantiate javascript objects equivalent to the contents of a wddx packet or some cfml data structures. Category extensibili...

  • Page 324

    306 chapter 2 coldfusion tags usage use this tag to serialize and deserialize packets of data used to communicate with the browser. For complete information on wddx, see developing coldfusion applications. Example select message_id, thread_id, username from messages the recordset data is:... #messag...

  • Page 325: Coldfusion Functions

    Chapter 3 coldfusion functions this chapter describes the functions in coldfusion markup language (cfml). The introduction of this chapter includes: • a summary of coldfusion functions • a list of new functions in coldfusion 5 • a list of functions by category the rest of this chapter provides descr...

  • Page 326

    308 chapter 3 coldfusion functions alphabetical list of coldfusion functions abs decimalformat isstruct quotedvaluelist acos decrementvalue iswddx rand arrayappend decrypt javacast randomize arrayavg deleteclientvariable jsstringformat randrange arrayclear directoryexists lcase refind arraydeleteat ...

  • Page 327

    Alphabetical list of coldfusion functions 309 bitmaskset gethttprequestdata ljustify stripcr bitnot gethttptimestring log structappend bitor getmetricdata log10 structclear bitshln getprofilestring lscurrencyformat structcopy bitshrn gettempdirectory lsdateformat structcount bitxor gettempfile lseur...

  • Page 328: Array Functions

    310 chapter 3 coldfusion functions new functions in coldfusion 5 array functions authentication functions conversion functions dayofyear isnumericdate queryaddcolumn writeoutput daysinmonth isprotected queryaddrow xmlformat daysinyear isquery querynew year de (delay evaluation) issimplevalue queryse...

  • Page 329: Date And Time Functions

    Alphabetical list of coldfusion functions 311 date and time functions decision functions display and formatting functions createdate datediff gethttptimestring minute createdatetime dateformat gettimezoneinfo month createodbcdate datepart hour monthasstring createodbcdatetime day isdate now createod...

  • Page 330: International Functions

    312 chapter 3 coldfusion functions dynamic evaluation functions international functions list functions mathematical functions de (delay evaluation) iif evaluate setvariable dateconvert lseurocurrencyformat lsparsedatetime gethttptimestring lsiscurrency lsparseeurocurrency getlocale lsisdate lsparsen...

  • Page 331: Query Functions

    Alphabetical list of coldfusion functions 313 query functions string functions see also “conversion functions” on page 310 . Bitand ceiling log10 sin bitmaskclear cos max sqr bitmaskread decrementvalue min tan bitmaskset exp pi bitnot fix rand isquery querysetcell queryaddcolumn quotedvaluelist quer...

  • Page 332: Structure Functions

    314 chapter 3 coldfusion functions structure functions system functions other functions duplicate structcount structget structkeylist isstruct structdelete structinsert structnew structappend structfind structisempty structsort structclear structfindkey structkeyarray structupdate structcopy structf...

  • Page 333

    Alphabetical list of coldfusion functions 315 abs description returns the absolute value of a number. The absolute value of a number is the number without its sign. Category mathematical functions syntax abs(number ) see also sgn parameters example abs example the absolute value of the following num...

  • Page 334

    316 chapter 3 coldfusion functions acos description returns the arc cosine of a number, in radians. The arc cosine is the angle whose cosine is number. Category mathematical functions syntax acos(number) see also cos , sin , asin , tan , pi parameters usage the range of the result is 0 to π . To con...

  • Page 335

    Alphabetical list of coldfusion functions 317 type in a number to get its arccosine in radians and degrees..

  • Page 336

    318 chapter 3 coldfusion functions arrayappend description appends an array index to an array. Returns a boolean true on successful completion. Category array functions syntax arrayappend(array, value) see also arrayprepend parameters example select firstname, lastname from employees #arrayappend(my...

  • Page 337

    Alphabetical list of coldfusion functions 319 arrayavg description returns the average of the values in an array. Category array functions syntax arrayavg(array) parameters example this example uses arrayavg to find the average of the numbers that you enter into an array. If you would like to enter ...

  • Page 338

    320 chapter 3 coldfusion functions the average of the numbers that you entered is #arrayavg(mynumberarray)#. Try again. You must enter at least two numeric values..

  • Page 339

    Alphabetical list of coldfusion functions 321 arrayclear description deletes all data in an array. Returns a boolean true on successful completion. Category array functions syntax arrayclear(array) see also arraydeleteat parameters example your array contents are: #arraytolist(myarray)# is the array...

  • Page 340

    322 chapter 3 coldfusion functions arraydeleteat description deletes data from an array at an index position. When an array index is deleted, index positions are recalculated. For example, in an array that contains the months of the year, deleting index position [5] removes the entry for may. To the...

  • Page 341

    Alphabetical list of coldfusion functions 323 arrayinsertat description inserts data in an array at an index position. Array elements with indexes greater than the new position are shifted right by one. The length of the array increases by one index. Returns a boolean true on successful completion. ...

  • Page 342

    324 chapter 3 coldfusion functions arrayisempty description determines whether an array is empty of data. Returns a boolean true if the array is empty; otherwise false. Category array functions syntax arrayisempty(array) see also arraylen parameters example your array contents are: #arraytolist(myar...

  • Page 343

    Alphabetical list of coldfusion functions 325 arraylen description returns the length of an array. Category array functions syntax arraylen(array) see also arrayisempty parameters example select firstname, lastname from employees the contents of the array are as follows: #mylist# this array has #arr...

  • Page 344

    326 chapter 3 coldfusion functions arraymax description returns the largest numeric value in an array. Category array functions syntax arraymax(array) parameters example this example uses arraymax to find the largest number that you have entered into an array. The largest number that you entered is ...

  • Page 345

    Alphabetical list of coldfusion functions 327.

  • Page 346

    328 chapter 3 coldfusion functions arraymin description returns the smallest numeric value in an array. Category array functions syntax arraymin(array) parameters example this example uses arraymin to find the smallest number in an array. The smallest number that you entered is #arraymin(mynumberarr...

  • Page 347

    Alphabetical list of coldfusion functions 329.

  • Page 348

    330 chapter 3 coldfusion functions arraynew description creates an array of 1 to 3 dimensions. Array elements are indexed with square brackets: [ ]. Coldfusion arrays expand dynamically as data is added. Category array functions syntax arraynew(dimension) parameters example is this an array? #isarra...

  • Page 349

    Alphabetical list of coldfusion functions 331 arrayprepend description adds an array element to the beginning of an array. Returns a boolean true on successful completion. Category array functions syntax arrayprepend(array, value) see also arrayappend parameters example select firstname, lastname fr...

  • Page 350

    332 chapter 3 coldfusion functions arrayresize description resets an array to a specified minimum number of elements. Arrayresize can provide some performance gains if used to size an array to its expected maximum. For arrays greater than 500 elements, use arrayresize immediately after creating an a...

  • Page 351

    Alphabetical list of coldfusion functions 333 arrayset description in a one-dimensional array, sets the elements in a specified range to a value. Useful in initializing an array after a call to arraynew . Returns a boolean true on successful completion. Category array functions syntax arrayset(array...

  • Page 352

    334 chapter 3 coldfusion functions arraysort description sorts array elements numerically or alphanumerically. Note if the sort is successful, arraysort returns "yes". If not, arraysort returns "no". Category array functions syntax arraysort(array, sort_type [, sort_order ]) parameters example selec...

  • Page 353

    Alphabetical list of coldfusion functions 335 arraysum description returns the sum of values in an array. Category array functions syntax arraysum(array) parameters example this example uses arraysum to add two numbers together. The sum of the numbers is #arraysum(mynumberarray)#. Parameter descript...

  • Page 354

    336 chapter 3 coldfusion functions.

  • Page 355

    Alphabetical list of coldfusion functions 337 arrayswap description swaps array values of an array at specified positions. Arrayswap can be used with greater efficiency than multiple cfset tags. Returns a boolean true on successful completion. Category array functions syntax arrayswap(array, positio...

  • Page 356

    338 chapter 3 coldfusion functions arraytolist description converts a one dimensional array to a list, delimited with the character you specify. Category array functions syntax arraytolist(array [, delimiter ]) parameters example select firstname, lastname from employees the contents of the array ar...

  • Page 357

    Alphabetical list of coldfusion functions 339 asc description returns the ascii value (character code) of the first character of a string. Returns 0 if stringis empty. Category string functions syntax asc(string) see also chr parameters example asc example #left(form.Charvals,1)# = #asc(form.Charval...

  • Page 358

    340 chapter 3 coldfusion functions asin description returns the arcsine of a number, in radians. The arcsine is the angle whose sine is number. Category mathematical functions syntax asin(number) see also sin , cos , pi , tan parameters usage the range of the result is - π /2 to π /2 radians. To con...

  • Page 359

    Alphabetical list of coldfusion functions 341 calculated in degrees and radians. The value must be between 1 and -1,inclusive. Type in a number to get its arcsine in radians and degrees..

  • Page 360

    342 chapter 3 coldfusion functions atn description returns the arctangent of a number. The arctangent is the angle whose tangent is number. Category mathematical functions syntax atn(number) see also tan , sin , cos , pi parameters usage the range of the result is - π /2 to π /2 radians. To convert ...

  • Page 361

    Alphabetical list of coldfusion functions 343 authenticatedcontext description returns the name of the security context. See also isauthenticated , authenticateduser , isauthorized , cfauthenticate syntax authenticatedcontext() example authenticatedcontext example secure context is: authenticatedcon...

  • Page 362

    344 chapter 3 coldfusion functions authenticateduser description returns the name of an authenticated user. See also isauthenticated , authenticatedcontext , cfauthenticate syntax authenticateduser() example authenticateduser example authenticated user: authenticateduser() . . ..

  • Page 363

    Alphabetical list of coldfusion functions 345 bitand description returns the bitwise and of two long integers. Category mathematical functions syntax bitand(number1, number2) see also bitnot , bitor , bitxor parameters usage bit functions operate on 32-bit signed integers, in the range -2147483648 t...

  • Page 364

    346 chapter 3 coldfusion functions bitmaskclear description returns number bitwise, cleared, with length bits beginning from start. Category mathematical functions syntax bitmaskclear(number, start, length) see also bitmaskread , bitmaskset parameters usage bit functions operate on 32-bit signed int...

  • Page 365

    Alphabetical list of coldfusion functions 347 bitmaskread description returns the integer created from length bits of number beginning from start. Category mathematical functions syntax bitmaskread(number, start, length) see also bitmaskclear , bitmaskset parameters usage bit functions operate on 32...

  • Page 366

    348 chapter 3 coldfusion functions bitmaskset description returns number bitwise masked with length bits of mask beginning from start. Category mathematical functions syntax bitmaskset(number, mask, start, length) see also bitmaskclear , bitmaskread parameters usage bit functions operate on 32-bit s...

  • Page 367

    Alphabetical list of coldfusion functions 349 bitnot description returns the bitwise not of a long integer. Category mathematical functions syntax bitnot(number) see also bitand , bitor , bitxor parameters usage bit functions operate on 32-bit signed integers, in the range -2147483648 to 2147483647....

  • Page 368

    350 chapter 3 coldfusion functions bitor description returns the bitwise or of two long integers category mathematical functions syntax bitor(number1, number2) see also bitand , bitnot , bitxor parameters usage bit functions operate on 32-bit integers, in the range -2147483648 to 2147483647. Example...

  • Page 369

    Alphabetical list of coldfusion functions 351 bitshln description returns number bitwise shifted without rotation to the left by count bits. Category mathematical functions syntax bitshln(number, count) see also bitshrn parameters usage bit functions operate on 32-bit signed integers, in the range -...

  • Page 370

    352 chapter 3 coldfusion functions bitshrn description returns number bitwise shifted without rotation to the right by count bits. Category mathematical functions syntax bitshrn(number, count) see also bitshln parameters usage bit functions operate on 32-bit signed integers, in the range -2147483648...

  • Page 371

    Alphabetical list of coldfusion functions 353 bitxor description returns bitwise xor of two long integers. Category mathematical functions syntax bitxor(number1, number2) see also bitand , bitnot , bitor parameters usage bit functions operate on 32-bit signed integers, in the range -2147483648 to 21...

  • Page 372

    354 chapter 3 coldfusion functions ceiling description returns the closest integer greater than a given number. Category mathematical functions syntax ceiling(number) see also int , fix , round parameters example the ceiling of 3.4 is #ceiling(3.4)# the ceiling of 3 is #ceiling(3)# the ceiling of 3....

  • Page 373

    Alphabetical list of coldfusion functions 355 chr description returns a character of a given ascii value (character code). Category string functions syntax chr(number) parameters usage numbers 0–31 are the standard, nonprintable, ascii codes. For example, chr(10) returns a linefeed character and chr...

  • Page 374

    356 chapter 3 coldfusion functions cjustify description centers a string in a field length. Category string functions syntax cjustify(string, length) see also ljustify , rjustify parameters example cjustify example enter a string, and it will be center justified within the sample field size = 35 nam...

  • Page 375

    Alphabetical list of coldfusion functions 357 compare description performs a case-sensitive comparison of two strings. Returns: • -1 if string1 is less than string2 • 0 if string1 is equal to string2 • 1 if string1 is greater than string2 category string functions syntax compare(string1, string2) se...

  • Page 376

    358 chapter 3 coldfusion functions the strings are not equal string 1 string 2.

  • Page 377

    Alphabetical list of coldfusion functions 359 comparenocase description performs a case-insensitive comparison of two strings. Returns: • a negative number if string1 is less than string2 • 0 if string1 is equal to string2 • a positive number if string1 is greater than string2 category string functi...

  • Page 378

    360 chapter 3 coldfusion functions cos description returns the cosine of an angle, in radians. Category mathematical functions syntax cos(number) see also sin , tan , pi parameters usage the range of the result is - 1 to 1 . To convert degrees to radians, multiply degrees by π /180. To convert radia...

  • Page 379

    Alphabetical list of coldfusion functions 361 createdate description returns a valid date/time object. Category date and time functions syntax createdate(year, month, day) see also createdatetime , createodbcdate parameters usage createdate is a subset of createdatetime . Time in the returned object...

  • Page 380

    362 chapter 3 coldfusion functions the same value can be formatted with dateformat: form.Month, form.Day), "mmm-dd-yyyy")# form.Month, form.Day, 12,13,0))# "mmmm d, yyyy")# #dateformat(createodbcdatetime(yourdate), "d/m/yy")# please enter the year, month and day in integer format for the date value ...

  • Page 381

    Alphabetical list of coldfusion functions 363 createdatetime description returns a valid date/time object. Category date and time functions syntax createdatetime(year, month, day, hour, minute, second) see also createdate , createtime , createodbcdatetime , now parameters usage year values 0 - 29 ar...

  • Page 382

    364 chapter 3 coldfusion functions the same value can be formatted with dateformat: #dateformat(createdate (form.Year,form.Month,form.Day), "mmm-dd-yyyy")# #dateformat(createdatetime (form.Year, form.Month, form.Day, form.Hour, form.Minute, form.Second))# #dateformat(createodbcdate(yourdate), "mmmm ...

  • Page 383: Createobject Object Types

    Alphabetical list of coldfusion functions 365 createobject description lets you create com, corba, and java objects. Note coldfusion administrators can disable the cfobject tag using the tag restrictions page under the coldfusion basic security page, which also disables this function. Createobject o...

  • Page 384

    366 chapter 3 coldfusion functions com description createobject lets you create and use component object model (com) objects. An automation server object type that is currently registered on a computer can be invoked. You can use a utility like microsoft’s oleview utility to browse com objects. Olev...

  • Page 385

    Alphabetical list of coldfusion functions 367 corba description createobject lets you call methods in corba objects. The objects must have already been defined and registered for use. Category other functions syntax createobject("corba", class, context, locale ) parameters usage coldfusion enterpris...

  • Page 386

    368 chapter 3 coldfusion functions createobject description lets you create and use java objects, and, by extension, ejb objects. Category other functions syntax createobject("java", class) parameters usage to call java cfxs or java objects, coldfusion uses a jvm embedded in the process. The loading...

  • Page 387

    Alphabetical list of coldfusion functions 369 createodbcdate description returns a date in odbc date format. Category date and time functions syntax createodbcdate(date) see also createdate , createodbcdatetime parameters example createodbcdate example your date value, presented using different cf d...

  • Page 388

    370 chapter 3 coldfusion functions the same value can be formatted with dateformat: #dateformat(createdate (form.Year, form.Month, form.Day), "mmm-dd-yyyy")# #dateformat(createdatetime (form.Year, form.Month, form.Day, form.Hour, form.Minute,form.Second))# #dateformat(createodbcdate(yourdate), "mmmm...

  • Page 389

    Alphabetical list of coldfusion functions 371 createodbcdatetime description returns a date/time object in odbc timestamp format. Category date and time functions syntax createodbcdatetime(date) see also createdatetime , createodbcdate , createodbctime , now parameters usage when passing a date/time...

  • Page 390

    372 chapter 3 coldfusion functions (form.Year, form.Month, form.Day), "mmm-dd-yyyy")# (form.Year, form.Month, form.Day, form.Hour, form.Minute, form.Second))# #dateformat(createodbcdate(yourdate), "mmmm d, yyyy")# #dateformat(createodbcdatetime(yourdate), "d/m/yy")# please enter the year, month and ...

  • Page 391

    Alphabetical list of coldfusion functions 373 createodbctime description returns a time object in odbc time format. Category date and time functions syntax createodbctime(date) see also createodbcdatetime , createtime parameters usage when passing a date/time value as a string, enclose it in quotes....

  • Page 392

    374 chapter 3 coldfusion functions message = "you must enter a minute value (0-59)" validate = "integer" required = "yes"> second message = "you must enter a value for seconds (0-59)" validate = "integer" required = "yes"> message = "you must enter a value for seconds (0-59)" validate = "integer" re...

  • Page 393

    Alphabetical list of coldfusion functions 375 createtime description returns a time variable in coldfusion. Category date and time functions syntax createtime(hour, minute, second) see also createodbctime , createdatetime parameters usage createtime is a subset of createdatetime . Time variables are...

  • Page 394

    376 chapter 3 coldfusion functions createtimespan description creates a date/time object that defines a time period. You can add or subtract it from other date/time objects and use it with the cachedwithin attribute of cfquery . Category date and time functions syntax createtimespan(days, hours, min...

  • Page 395

    Alphabetical list of coldfusion functions 377 park name region state maxrows = "#maxrows#"> #getparks.Currentrow# #parkname# #region# #state# maxrows = "#maxrows#"> #getparks.Currentrow# #parkname# #region# #state# #evaluate(startrow + maxrows)#"> see next #maxrows# rows.

  • Page 396

    378 chapter 3 coldfusion functions createuuid description returns a universally unique identifier (uuid) in the format ‘xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxx’ where ‘x’ stands for a hexadecimal digit (0-9 or a-f). Category other functions syntax createuuid() usage a uuid, returned by createuuid , is a ...

  • Page 397

    Alphabetical list of coldfusion functions 379 dateadd description returns a date to which a time interval has been added. Category date and time functions syntax dateadd(datepart, number, date) see also dateconvert , datepart , createtimespan parameters usage the datepart specifiers "y," "d," and "w...

  • Page 398

    380 chapter 3 coldfusion functions years quarters months days of year weekdays weeks hours minutes seconds years ). Posted) lt now()>expired.

  • Page 399

    Alphabetical list of coldfusion functions 381 datecompare description performs a full date/time comparison of two dates. Returns: • -1 if date1 is less than date2 • 0 if date1 is equal to date2 • 1 if date1 is greater than date2 category date and time functions syntax datecompare(date1, date2 [, dat...

  • Page 400

    382 chapter 3 coldfusion functions form.Precision)> #dateformat(form.Date1)# form.Precision)> #timeformat(form.Date1)# (date 1) is earlier than #dateformat(form.Date2)# #timeformat(form.Date2)# (date 2) the dates are not equal #timeformat(form.Date1)# to #dateformat(form.Date2)# #timeformat(form.Dat...

  • Page 401

    Alphabetical list of coldfusion functions 383 second minute hour day month year.

  • Page 402

    384 chapter 3 coldfusion functions dateconvert description converts local time to universal coordinated time (utc) or utc to local time, based on parameters. The function uses the daylight savings settings in the executing computer to compute daylight savings time, if required. Category date and tim...

  • Page 403

    Alphabetical list of coldfusion functions 385 form.Day, form.Hour,form.Minute, form.Second)> your date value, presented as a coldfusion date/time string:#yourdate#. Form.Day, form.Hour,form.Minute, form.Second)> your date value, presented as a coldfusion date/time string:#yourdate#. Your date and ti...

  • Page 404

    386 chapter 3 coldfusion functions range = "0,59" message = "you must enter a minute value (0-59)" validate = "integer" required = "yes"> range = "0,59" message = "you must enter a value for seconds (0-59)" validate = "integer" required = "yes">.

  • Page 405

    Alphabetical list of coldfusion functions 387 datediff description returns the number of intervals, in units of type datepart, by which date1 is less than date2. Category date and time functions syntax datediff(datepart, date1, date2) see also dateadd , datepart , createtimespan parameters usage to ...

  • Page 406

    388 chapter 3 coldfusion functions this example uses datediff to determine the difference in years quarters months days of year days weekdays weeks hours minutes seconds years dateparts between date1 and date2. The difference is #abs(datediff (type, form.Date2, form.Date1))# years quarters months da...

  • Page 407

    Alphabetical list of coldfusion functions 389 dateformat description returns a formatted date/time value. If no mask is specified, dateformat returns the date value in the dd-mmm-yy format. Dateformat supports dates that have the u.S. Date format. For international date support, use lsdateformat . C...

  • Page 408

    390 chapter 3 coldfusion functions today’s date is #todaydate#. Using dateformat, we can display that date in different ways:.

  • Page 409

    Alphabetical list of coldfusion functions 391 datepart description returns part of a date as an integer. Category date and time functions syntax datepart(datepart, date) see also dateadd , dateconvert parameters usage year values 0 - 29 are interpreted as 21 st century dates. Year values 30 - 99 are...

  • Page 410

    392 chapter 3 coldfusion functions.

  • Page 411

    Alphabetical list of coldfusion functions 393 day description returns the ordinal for the day of the month, ranging from 1 to 31. Category date and time functions syntax day(date) see also dayofweek , dayofweekasstring , dayofyear , daysinmonth , daysinyear , firstdayofmonth parameters usage year va...

  • Page 412

    394 chapter 3 coldfusion functions this is not a leap year ....

  • Page 413

    Alphabetical list of coldfusion functions 395 dayofweek description returns the ordinal for the day of the week. The day is given as an integer in the range 1 (sunday) to 7 (saturday). Category date and time functions see also day , dayofweekasstring , dayofyear , daysinmonth , daysinyear , firstday...

  • Page 414

    396 chapter 3 coldfusion functions this is a leap year this is not a leap year ....

  • Page 415

    Alphabetical list of coldfusion functions 397 dayofweekasstring description returns the day of the week corresponding to day_of_week, an integer in the range 1 (sunday) to 7 (saturday). Category date and time functions syntax dayofweekasstring(day_of_week) see also day , dayofweek , dayofyear , days...

  • Page 416

    398 chapter 3 coldfusion functions dayofyear description returns the ordinal for the day of the year. Category date and time functions syntax dayofyear(date) see also day , dayofweek , dayofweekasstring , daysinmonth , daysinyear , firstdayofmonth parameters usage dayofyear accounts for leap years. ...

  • Page 417

    Alphabetical list of coldfusion functions 399 we are in week #week(yourdate)# of #year(yourdate)# (day #dayofyear(yourdate)# of #daysinyear(yourdate)#). This is a leap year this is not a leap year ....

  • Page 418

    400 chapter 3 coldfusion functions daysinmonth description returns the number of days in a month (date). Category date and time functions syntax daysinmonth(date) see also day , dayofweek , dayofweekasstring , dayofyear , daysinyear , firstdayofmonth parameters usage year values 0 – 29 are interpret...

  • Page 419

    Alphabetical list of coldfusion functions 401 daysinyear description returns the number of days in a year. Category date and time functions syntax daysinyear(date) see also day , dayofweek , dayofweekasstring , dayofyear , daysinmonth , daysinyear , firstdayofmonth , isleapyear parameters usage days...

  • Page 420

    402 chapter 3 coldfusion functions de (delay evaluation) description returns its argument wrapped in double quotes, and inner double quotes escaped. De prevents evaluation of a string as an expression when it is passed as an argument to iif or evaluate . Category dynamic evaluation functions syntax ...

  • Page 421

    Alphabetical list of coldfusion functions 403 decimalformat description returns number as a string formatted with two decimal places and a thousands separator. Category display and formatting functions syntax decimalformat(number) see also dollarformat , numberformat parameters example decimalformat...

  • Page 422

    404 chapter 3 coldfusion functions decrementvalue description returns integer part of number decremented by one. Category mathematical functions syntax decrementvalue(number) see also incrementvalue parameters example decrementvalue example returns the integer part of a number decremented by one. De...

  • Page 423

    Alphabetical list of coldfusion functions 405 decrypt description decrypts an encrypted string. Category string functions syntax decrypt(encrypted_string, seed) see also duplicate , encrypt parameters example this function allows for the encryption and decryption of a string. Try it by entering a st...

  • Page 424

    406 chapter 3 coldfusion functions deleteclientvariable description deletes the client variable specified by name. Returns a boolean true when variable is successfully deleted, even if variable did not previously exist. To test for the existence of a variable, use isdefined . Category other function...

  • Page 425

    Alphabetical list of coldfusion functions 407 directoryexists description returns yes if the directory specified in the argument exists; otherwise, returns no. Category system functions syntax directoryexists(absolute_path) see also fileexists parameters example directoryexists example - 1"))> the c...

  • Page 426

    408 chapter 3 coldfusion functions dollarformat description returns number as a string formatted with two decimal places, thousands separator, and dollar sign. If number is negative, parentheses are used. Returns strings in u.S. Format. For other currencies, use lscurrencyformat or lseurocurrencyfor...

  • Page 427

    Alphabetical list of coldfusion functions 409 duplicate description returns a clone, also known as a deep copy, of a variable. Unlike structcopy , duplicate copies the variable, so there is no reference to the original variable. Category structure functions syntax duplicate(variable_name) see also s...

  • Page 428

    410 chapter 3 coldfusion functions encrypt description encrypts a string. Encrypt uses a symmetric key-based algorithm in which the same key is used to encrypt and decrypt a string. The security of the encrypted string depends on maintaining the secrecy of the key. Encrypt uses an xor-based algorith...

  • Page 429

    Alphabetical list of coldfusion functions 411 this string will be encrypted (try typing some more).

  • Page 430

    412 chapter 3 coldfusion functions evaluate description evaluates arguments, left to right; returns the result of evaluating the last argument. Category dynamic evaluation functions syntax evaluate(string_expression1 [, string_expression2 [, … ] ] ) see also de (delay evaluation) , iif parameters us...

  • Page 431

    Alphabetical list of coldfusion functions 413 exp description returns e raised to the power of number. The constant e equals 2.71828182845904, the base of the natural logarithm. Category mathematical functions syntax exp(number) see also log , log10 parameters usage to calculate powers of other base...

  • Page 432

    414 chapter 3 coldfusion functions expandpath description returns a path equivalent to the relative_path appended to the base template path. Note: • expandpath creates a platform-appropriate path. You can use a slash (/) or backslash (\) in a relative path. • the return value contains a trailing sla...

  • Page 433

    Alphabetical list of coldfusion functions 415 fileexists description returns yes if the file specified in the argument exists; otherwise, returns no. Category system functions syntax fileexists(absolute_path) see also directoryexists , expandpath , gettemplatepath parameters example fileexists examp...

  • Page 434

    416 chapter 3 coldfusion functions find description returns the first index of an occurrence of a substring in a string from a specified starting position. Returns 0 if substring is not in string. The search is case-sensitive. Category string functions syntax find(substring, string [, start ]) see a...

  • Page 435

    Alphabetical list of coldfusion functions 417 findnocase description returns the first index of an occurrence of a substring in a string from a specified starting position. Returns 0 if substring is not in string. The search is case-insensitive. Category string functions syntax findnocase(substring,...

  • Page 436

    418 chapter 3 coldfusion functions findoneof description return the first index of the occurrence of a character from set in string. Returns 0 if no characters are found. The search is case-sensitive. Category string functions syntax findoneof(set, string [, start ]) see also find , compare , refind...

  • Page 437

    Alphabetical list of coldfusion functions 419 firstdayofmonth description returns the ordinal (the day’s number in the year) for the first day of a month. Category date and time functions syntax firstdayofmonth(date) see also day , dayofweek , dayofweekasstring , dayofyear , daysinmonth , daysinyear...

  • Page 438

    420 chapter 3 coldfusion functions fix description returns the closest integer less than number, if number is greater than or equal to 0. Returns the closest integer greater than number, if number is less than 0. Category mathematical functions syntax fix(number) see also ceiling , int , round param...

  • Page 439

    Alphabetical list of coldfusion functions 421 formatbasen description converts number to a string in the base specified by radix. Category mathematical functions syntax formatbasen(number, radix) see also inputbasen parameters example formatbasen converts a number to a string in the base specified b...

  • Page 440

    422 chapter 3 coldfusion functions getbasetagdata description returns an object that contains data (variables, scopes, and so on) from an ancestor tag. By default, returns the closest ancestor. If there is no ancestor by the specified name, or if the ancestor does not expose data (for example, cfif ...

  • Page 441

    Alphabetical list of coldfusion functions 423 getbasetaglist description returns a comma-delimited list of uppercase ancestor tag names. The first element of the list is the parent tag. If you call getbasetaglist for a top-level tag, it returns an empty string. Category other functions syntax getbas...

  • Page 442

    424 chapter 3 coldfusion functions getbasetemplatepath description returns the fully specified path of the base template. Category system functions syntax getbasetemplatepath() see also getcurrenttemplatepath , fileexists , expandpath example getbasetemplatepath example the template path of the curr...

  • Page 443

    Alphabetical list of coldfusion functions 425 getclientvariableslist description returns a list of non-read-only client variables available to a template. Category other functions syntax getclientvariableslist() see also deleteclientvariable usage you can use the list of variables returned by getcli...

  • Page 444

    426 chapter 3 coldfusion functions getcurrenttemplatepath description returns the fully specified path of the template that contains the call to this function. Category system functions syntax getcurrenttemplatepath() see also getbasetemplatepath , fileexists , expandpath usage this function differs...

  • Page 445

    Alphabetical list of coldfusion functions 427 getdirectoryfrompath description extracts the directory (with a backslash) from a fully specified path. Category system functions syntax getdirectoryfrompath(path) see also expandpath , getfilefrompath parameters example the current directory is: #getdir...

  • Page 446

    428 chapter 3 coldfusion functions getexception description used with cftry and cfcatch, this function allow you to retrieve a java exception object from a java object. Returns any java exception object raised by the previous method call on the java object. Category system functions syntax getexcept...

  • Page 447

    Alphabetical list of coldfusion functions 429 getfilefrompath description extracts a filename from a fully specified path. Category system functions syntax getfilefrompath(path) see also expandpath , getcurrenttemplatepath parameters example the current directory is: #getdirectoryfrompath(thispath)#...

  • Page 448

    430 chapter 3 coldfusion functions getfunctionlist description returns a structure of functions that are available in coldfusion. Category system functions syntax getfunctionlist() example #structcount(flist)# functions #key#.

  • Page 449

    Alphabetical list of coldfusion functions 431 gethttprequestdata description m akes http request headers and body available to cfml pages. Does not take arguments. Returns a coldfusion structure. Gethttprequestdata is especially useful for capturing soap request data, which can be delivered in an ht...

  • Page 450

    432 chapter 3 coldfusion functions http_content --- #x.Content#.

  • Page 451

    Alphabetical list of coldfusion functions 433 gethttptimestring description this function takes one argument, a coldfusion date/time object, and returns the time formatted as a string according to the http standard described in rfc 1123. Category date and time functions syntax gethttptimestring(date...

  • Page 452

    434 chapter 3 coldfusion functions getlocale description returns the locale for the current request. Locales are determined by the native operating system. A locale is an encapsulation of the set of attributes that govern the display and formatting of international date, time, number, and currency v...

  • Page 453

    Alphabetical list of coldfusion functions 435 the locale for this system is #getlocale()#.

  • Page 454

    436 chapter 3 coldfusion functions getmetricdata description on windows nt, getmetricdata returns system and application metrics, depending on the value of the mode parameter. Category system functions syntax getmetricdata(mode) parameters usage on windows nt, if you use mode = "perf_monitor" the fu...

  • Page 455

    Alphabetical list of coldfusion functions 437 • avgdbtime • cachepops example current perfmonitor data is: instancename:#pmdata.Instancename# pagehits:#pmdata.Pagehits# reqqueued: #pmdata.Reqqueued# dbhits: #pmdata.Dbhits# reqrunning: #pmdata.Reqrunning# reqtimedout: #pmdata.Reqtimedout# bytesin: #p...

  • Page 456

    438 chapter 3 coldfusion functions getprofilestring description returns the value of an entry in an initialization file, or an empty string if the value does not exist. An initialization file assigns values to configuration variables, also known as entries, that must be set when the system boots, th...

  • Page 457

    Alphabetical list of coldfusion functions 439.

  • Page 458

    440 chapter 3 coldfusion functions gettempdirectory description returns the full pathname of a directory, including the trailing slash. The directory that is returned depends on the account under which coldfusion is running and other factors. Before using this function in an application, test to det...

  • Page 459

    Alphabetical list of coldfusion functions 441 gettempfile description creates and returns the name of a temporary file in a directory whose name starts with (at most) the first three characters of prefix. Category system functions syntax gettempfile(dir, prefix) see also gettempdirectory parameters ...

  • Page 460

    442 chapter 3 coldfusion functions gettemplatepath description returns the fully specified path of the base template. Note for backward compatibility, gettemplatepath is still supported. However, getbasetemplatepath supersedes this function, and should be used in place of it. Category system functio...

  • Page 461

    Alphabetical list of coldfusion functions 443 gettickcount description returns a millisecond clock counter that can be used for timing sections of cfml code or other aspects of page processing. Category date and time functions syntax gettickcount() usage generate useful timing values by taking diffe...

  • Page 462

    444 chapter 3 coldfusion functions gettimezoneinfo description returns a structure that contains time zone information for the computer on which it is executed. The structure contains four elements with the following keys: • utctotaloffset offset of the local time, in minutes, from universal coordin...

  • Page 463

    Alphabetical list of coldfusion functions 445 gettoken description returns a token in a string. Default delimiters are spaces, tabs, and newline characters. If index is greater than the number of tokens in string, gettoken returns an empty string. Category string functions syntax gettoken(string, in...

  • Page 464

    446 chapter 3 coldfusion functions hash description converts a variable-length string to a 32-byte, hexadecimal string, using the md5 algorithm. The algorithm is a one-way hash—there is no conversion from the hash result back to the source string. Category string functions syntax hash(string) parame...

  • Page 465

    Alphabetical list of coldfusion functions 447 hour description returns the ordinal value for the hour, in the range 0 - 23. Category date and time functions syntax hour(date) see also datepart , minute , second parameters usage year values 0 – 29 are interpreted as 21 st century dates. Year values 3...

  • Page 466

    448 chapter 3 coldfusion functions htmlcodeformat description returns html escaped string enclosed in and tags. Carriage returns are removed from string, and special characters (> category display and formatting functions syntax htmlcodeformat(string [, version ]) see also htmleditformat parameters ...

  • Page 467

    Alphabetical list of coldfusion functions 449 /"> because you entered no url or an empty string, the tag /"> will return the following address: http://localhost/cfdocs/ index.Htm method = "get" resolveurl = yes> method = "get" resolveurl = yes> method = "get" resolveurl = yes> method = "get" resolve...

  • Page 468

    450 chapter 3 coldfusion functions htmleditformat description returns html escaped string. Carriage returns are removed from string, and special characters (> category display and formatting functions syntax htmleditformat(string [, version ]) see also htmlcodeformat parameters usage by escaping spe...

  • Page 469

    Alphabetical list of coldfusion functions 451 /"> because you entered no url or an empty string, the tag /"> will return the following address: http://localhost/cfdocs/index.Htm method = "get" resolveurl = yes> method = "get" resolveurl = yes> method = "get" resolveurl = yes> method = "get" resolveu...

  • Page 470

    452 chapter 3 coldfusion functions iif description the function evaluates condition as a boolean. If the result is true, it returns the value of evaluate(string_expression1) ; otherwise, it returns the value of evaluate(string_expression2) . Before using iif , read the usage section and note. Iif is...

  • Page 471

    Alphabetical list of coldfusion functions 453 for example, localvar is undefined; however, the following logic functions as you would expect if you do not use pound signs around localval : #iif(isdefined("localvar"), "localvar", de("the variable is not defined."))# the output is: the variable is not...

  • Page 472

    454 chapter 3 coldfusion functions incrementvalue description returns integer part of number incremented by one. Category mathematical functions syntax incrementvalue(number) see also decrementvalue parameters example incrementvalue example returns the integer part of a number incremented by one. In...

  • Page 473

    Alphabetical list of coldfusion functions 455 inputbasen description returns the number obtained by converting string using the base specified by radix, an integer ranging from 2 to 36. Category mathematical functions syntax inputbasen(string, radix) see also formatbasen parameters example formatbas...

  • Page 474

    456 chapter 3 coldfusion functions insert description inserts a substring in a string after a specified character position. Prepends the substring if position is equal to 0. Category string functions syntax insert(substring, string, position) see also removechars , len parameters example insert exam...

  • Page 475

    Alphabetical list of coldfusion functions 457 int description returns the closest integer that is smaller than a number. Category mathematical functions syntax int(number) see also ceiling , fix , round parameters example int example int returns the closest integer smaller than a number. Int(11.7) :...

  • Page 476

    458 chapter 3 coldfusion functions isarray description returns true if value is an array. Category decision functions , array functions syntax isarray(value [, number ]) parameters example is this an array? #isarray(mynewarray)# it has #arraylen(mynewarray)# elements. Contents: #arraytolist(mynewarr...

  • Page 477

    Alphabetical list of coldfusion functions 459 isauthenticated description returns true if the user is authenticated for a coldfusion security context. If you specify a security context name, isauthenticated returns true if the user is authenticated for it. See the usage section for crucial informati...

  • Page 478

    460 chapter 3 coldfusion functions isauthorized description returns true if the user is authorized to perform an action on a coldfusion resource. Category decision functions syntax isauthorized(resourcetype, resourcename [, action ]) see also isauthenticated parameters parameter description resource...

  • Page 479

    Alphabetical list of coldfusion functions 461 action types the following table shows the actions associated with each resourcetype. Usage before using the isauthorized function, ensure that advanced security is enabled in the coldfusion administrator, and define the security contexts. If you specify...

  • Page 480

    462 chapter 3 coldfusion functions isbinary description returns true if value is binary; otherwise, returns false. Category decision functions syntax isbinary(value) see also tobinary , tobase64 , isnumeric , yesnoformat parameters example isbinary example ... Parameter description value a value ......

  • Page 481

    Alphabetical list of coldfusion functions 463 isboolean description returns true if value can be converted to a boolean; otherwise, false. Category decision functions syntax isboolean(value) see also isnumeric , yesnoformat parameters example isboolean example is boolean is not boolean enter an expr...

  • Page 482

    464 chapter 3 coldfusion functions iscustomfunction description returns true if name can be called as a custom function; otherwise returns false. Category decision functions syntax iscustomfunction(name) parameters example function myfunc(){ return ""; } request.Myfunc = myfunc; if( iscustomfunction...

  • Page 483

    Alphabetical list of coldfusion functions 465 enter a string, and discover if it can be evaluated to a date value. Value = "#now()#">.

  • Page 484

    466 chapter 3 coldfusion functions isdate description returns true if string can be converted to a date/time value; otherwise, false. Coldfusion converts the boolean return value to its string equivalent, "yes" or "no." see the usage section for crucial information. Category decision functions synta...

  • Page 485

    Alphabetical list of coldfusion functions 467 isdebugmode description returns true if debugging mode is set in the coldfusion administrator; false if debugging mode is disabled. Category decision functions syntax isdebugmode() example isdebugmode example.

  • Page 486

    468 chapter 3 coldfusion functions isdefined description evaluates a string value to determine whether the variable named in it exists. Returns true if the variable is found, false if not found. Isdefined is an alternative to the parameterexists function, eliminating the need for cumbersome expressi...

  • Page 487

    Alphabetical list of coldfusion functions 469 isleapyear description returns true if the year is a leap year; otherwise, false. Category decision functions syntax isleapyear(year) see also daysinyear parameters example isleapyear example is a leap year is not a leap year enter a year value, and find...

  • Page 488

    470 chapter 3 coldfusion functions isnumeric description returns true if string can be converted to a number; otherwise, false. Supports numbers in u.S. Number format. For international number support, use lsisnumeric . Category decision functions syntax isnumeric(string) see also isbinary parameter...

  • Page 489

    Alphabetical list of coldfusion functions 471 isnumericdate description evaluates "real value" of date/time object. Returns true if the number represents "real value" of the date/time object; otherwise, false. Category decision functions syntax isnumericdate(number) see also isdate , parsedatetime p...

  • Page 490

    472 chapter 3 coldfusion functions isprotected description returns true if a resource is protected in an authenticated user’s security context. Category decision functions syntax isprotected(resourcetype, resourcename [, action]) see also isauthorized parameters parameter description resourcetype st...

  • Page 491

    Alphabetical list of coldfusion functions 473 action types the following table shows the actions associated with each resource type:. Usage isprotected returns true if the resource is protected by a rule in the security context or sandbox within which a request is processed. An application may have ...

  • Page 492

    474 chapter 3 coldfusion functions.

  • Page 493

    Alphabetical list of coldfusion functions 475 isquery description returns true if value is a query. Category decision functions syntax isquery(value) see also queryaddrow parameters example before the query is run, the value of getemployees is #getemployees# getemployees is currently a simple value ...

  • Page 494

    476 chapter 3 coldfusion functions issimplevalue description returns true if value is a string, number, boolean, or date/time value. Category decision functions syntax issimplevalue(value) parameters example before the query is run, the value of getemployees is #getemployees# getemployees is current...

  • Page 495

    Alphabetical list of coldfusion functions 477 isstruct description returns true if variable is a structure. Category structure functions syntax isstruct(variable ) parameters example this file is similar to addemployee.Cfm, which is called by structnew, structclear, and structdelete. It is an exampl...

  • Page 496

    478 chapter 3 coldfusion functions iswddx description returns true if the value is a well formed wddx packet and false if not. Category decision functions syntax iswddx(value) parameters usage this function processes the wddx packet specified in valu e using a validating xml parser which uses the wd...

  • Page 497

    Alphabetical list of coldfusion functions 479 input=#packet# output="s" validate="yes" input=#packet# output="s" validate="yes".

  • Page 498

    480 chapter 3 coldfusion functions javacast description indicates the data type conversion of a coldfusion variable to pass as an argument to an overloaded method of a java object. It should be used only for scalar and string arguments. Category string functions syntax javacast(type, variable) see a...

  • Page 499

    Alphabetical list of coldfusion functions 481 jsstringformat description returns a string that is safe to use with javascript. Category string functions syntax jsstringformat(string) parameters usage jsstringformat escapes special javascript characters, such as single quote, double quote, and newlin...

  • Page 500

    482 chapter 3 coldfusion functions lcase description returns string converted to lowercase. Category string functions syntax lcase(string) see also ucase parameters example lcase example your text, #form.Sampletext#, returned in lowercase is #lcase(form.Sampletext)# . Please enter some text. Enter y...

  • Page 501

    Alphabetical list of coldfusion functions 483 left description returns the count of characters from the beginning of a string argument. Category string functions syntax left(string, count) see also right , mid , len parameters example your string #form.Mytext# only has #len(form.Mytext)# characters....

  • Page 502

    484 chapter 3 coldfusion functions len description returns the length of a string or binary object. Category string functions syntax len(string or binary object) see also tobinary , left , right , mid parameters example len example your string, "#form.Mytext#", has #len(form.Mytext)# characters. Ple...

  • Page 503

    Alphabetical list of coldfusion functions 485 listappend description returns list with value appended to its last element. Category list functions syntax listappend(list, value [, delimiters ]) see also listprepend , listinsertat , listsetat parameters usage when appending an element into a list, co...

  • Page 504

    486 chapter 3 coldfusion functions listchangedelims description returns list with delimiter characters changed to new_delimiter string. Category list functions syntax listchangedelims(list, new_delimiter [, delimiters ]) see also listfirst , listqualify parameters example listchangedelims lets you c...

  • Page 505

    Alphabetical list of coldfusion functions 487 listcontains description returns the index of the first item that contains a specified substring. The search is case-sensitive. If the substring is not found in the list items, it returns zero (0). Category list functions syntax listcontains(list, substr...

  • Page 506

    488 chapter 3 coldfusion functions it will not find the substring "wo" in the list. Listfind the substring "wo" is in item #listfind(alist, "wo")# of the list. However, if you specify the entire string two, both listcontains and listfind will find it in the second item in the list. Listcontains the ...

  • Page 507

    Alphabetical list of coldfusion functions 489 listcontainsnocase description returns the index of the first element of a list that contains a specified substring within elements. The search is case-insensitive. If no element is found, returns 0. Category list functions syntax listcontainsnocase(list...

  • Page 508

    490 chapter 3 coldfusion functions listdeleteat description returns list with element deleted at the specified position. Category list functions syntax listdeleteat(list, position [, delimiters ]) see also listgetat , listsetat , listlen . Parameters usage coldfusion ignores empty list elements; thu...

  • Page 509

    Alphabetical list of coldfusion functions 491 listfind description returns the index of the first occurrence of a value within a list. Returns 0 if no value is found. The search is case-sensitive. Category list functions syntax listfind(list, value [, delimiters ]) see also listcontains , listfindno...

  • Page 510

    492 chapter 3 coldfusion functions it will not find the substring "wo" in the list. Listfind the substring "wo" is in item #listfind(alist, "wo")# of the list. However, if you specify the entire string two, both listcontains and listfind will find it in the second item in the list. Listcontains the ...

  • Page 511

    Alphabetical list of coldfusion functions 493 listfindnocase description returns the index of the first occurrence of a value within a list. Returns 0 if no value was found. The search is case-insensitive. Category list functions syntax listfindnocase(list, value [, delimiters ]) see also listcontai...

  • Page 512

    494 chapter 3 coldfusion functions listfirst description returns the first element of the list. Category list functions syntax listfirst(list [, delimiters ]) see also listgetat , listlast , listqualify parameters usage note coldfusion ignores empty list elements; thus, a list that is defined as "a,...

  • Page 513

    Alphabetical list of coldfusion functions 495 listgetat description returns the element at a given position. Category list functions syntax listgetat(list, position [, delimiters ]) see also listfirst , listlast , listqualify , listsetat parameters usage the first position in a list is denoted by th...

  • Page 514

    496 chapter 3 coldfusion functions listinsertat description returns list with value inserted at the specified position. Category list functions syntax listinsertat(list, position, value [, delimiters ]) see also listdeleteat , listappend , listprepend , listsetat parameters usage when inserting elem...

  • Page 515

    Alphabetical list of coldfusion functions 497 listlast description returns the last element of the list. Category list functions syntax listlast(list [, delimiters ]) see also listgetat , listfirst parameters usage note coldfusion ignores empty list elements; thus, a list that is defined as "a,b,c,,...

  • Page 516

    498 chapter 3 coldfusion functions listlen description returns the number of elements in the list. Category list functions syntax listlen(list [, delimiters ]) see also listappend , listdeleteat , listinsertat , listprepend . Parameters usage note coldfusion ignores empty list elements; thus, a list...

  • Page 517

    Alphabetical list of coldfusion functions 499 listprepend description returns list with value inserted at the first position, shifting other elements to the right. Category list functions syntax listprepend(list, value [, delimiters ]) see also listappend , listinsertat , listsetat parameters usage ...

  • Page 518

    500 chapter 3 coldfusion functions listqualify description returns a list with a qualifying character around each item in the list, such as double or single quotes. Category list functions syntax listqualify(list, qualifier [, delimiters ] [, elements ]) parameters usage the new list may not preserv...

  • Page 519

    Alphabetical list of coldfusion functions 501 the contents of the unqualified list are as follows: #mylist# the contents of the qualified list are as follows: #qualifiedlist1# the contents of the second qualified list are as follows: #qualifiedlist2#.

  • Page 520

    502 chapter 3 coldfusion functions listrest description returns list without its first element. Returns an empty list (empty string) if list has only one element. Category list functions syntax listrest(list [, delimiters ]) see also listfirst , listgetat , listlast parameters usage note coldfusion ...

  • Page 521

    Alphabetical list of coldfusion functions 503 listsetat description returns list with value assigned to its element at specified position. Category list functions syntax listsetat(list, position, value [, delimiters ]) see also listdeleteat , listgetat , listinsertat parameters usage when assigning ...

  • Page 522

    504 chapter 3 coldfusion functions subjects posted in messages. (#counter#) subject: #listgetat(temptoo, counter)# note that item 2, "#changeditem#", has been altered to "i changed this subject" using listsetat..

  • Page 523

    Alphabetical list of coldfusion functions 505 listsort description sorts and delimits the items in a list according to a sort type and sort order. Category list functions syntax listsort(list, sort_type [, sort_order] [, delimiter ]) parameters usage coldfusion ignores empty list elements; thus, a l...

  • Page 524

    506 chapter 3 coldfusion functions #sortedlist# here is a numeric list that is to be sorted in descending order. #sortednums# here is a list that must be sorted numerically, since it contains negative and positive numbers, as well as decimal numbers. "asc", ";,:")> #sortednums2# here is a list to be...

  • Page 525

    Alphabetical list of coldfusion functions 507 listtoarray description converts a list to an array. Category list functions syntax listtoarray(list [, delimiter ]) see also arraytolist parameters usage coldfusion ignores empty list elements; thus, a list that is defined as "a,b,c,,,d" is treated as a...

  • Page 526

    508 chapter 3 coldfusion functions listvaluecount description returns the number of instances of a specified value in a list. The search is case-sensitive. Category list functions syntax listvaluecount(list, value [, delimiters ]) see also listvaluecountnocase parameters example select department fr...

  • Page 527

    Alphabetical list of coldfusion functions 509 form.Departmentname)> there are no employees in #form.Departmentname# form.Departmentname)> cfoutput> there is only one person in #form.Departmentname#. There are #numberindepartment# people in #form.Departmentname#..

  • Page 528

    510 chapter 3 coldfusion functions listvaluecountnocase description returns the number of instances of a value in a list. The search is not case-sensitive. Category list functions syntax listvaluecountnocase(list, value [, delimiters ]) see also listvaluecount parameters example select department fr...

  • Page 529

    Alphabetical list of coldfusion functions 511 form.Departmentname)> there are no employees in #form.Departmentname# form.Departmentname)> there is only one person in #form.Departmentname#. There are #numberindepartment# people in #form.Departmentname#..

  • Page 530

    512 chapter 3 coldfusion functions ljustify description returns left-justified string of a field length. Category string functions syntax ljustify(string, length) see also cjustify , rjustify parameters example ljustify example enter a string, and it will be left justified within the sample field si...

  • Page 531

    Alphabetical list of coldfusion functions 513 log description returns the natural logarithm of a number. Natural logarithms are based on the constant e (2.71828182845904). Category international functions syntax log(number) see also exp , log10 parameters example your number, #form.Number# #form.Num...

  • Page 532

    514 chapter 3 coldfusion functions log10 description returns the logarithm of number to base 10. Category international functions syntax log10(number) see also exp , log parameters example log10 example your number, #form.Number# #form.Number# raised to the e power: #exp(form.Number)# you must enter...

  • Page 533

    Alphabetical list of coldfusion functions 515 lscurrencyformat description returns a currency value using the locale convention. Default value is "local." category international functions syntax lscurrencyformat(number [, type ]) see also lseurocurrencyformat parameters currency output the following...

  • Page 534

    516 chapter 3 coldfusion functions french (canadian) local: 100 000,00 $ international: cad100 000,00 none: 100 000,00 french (standard) local: 100 000,00 f international: frf100 000,00 none: 100 000,00 french (swiss) local: sfr. 100’000.00 international: chf100’000.00 none: 100’000.00 german (austr...

  • Page 535

    Alphabetical list of coldfusion functions 517 example lscurrencyformat returns a currency value using the locale convention. Default value is "local." index = "locale" delimiters = ","> #locale# local: #lscurrencyformat(100000, "local")# international: #lscurrencyformat(100000, "international")# non...

  • Page 536

    518 chapter 3 coldfusion functions lsdateformat description formats the date portion of a date/time value using the locale convention. Like dateformat , lsdateformat returns a formatted date/time value. If no mask is specified, lsdateformat returns a date value using the locale-specific format. Cate...

  • Page 537

    Alphabetical list of coldfusion functions 519 index = "locale" delimiters = ","> #locale# #lsdateformat(now(), "mmm-dd-yyyy")# #lsdateformat(now(), "mmmm d, yyyy")# #lsdateformat(now(), "mm/dd/yyyy")# #lsdateformat(now(), "d-mmm-yyyy")# #lsdateformat(now(), "ddd, mmmm dd, yyyy")# #lsdateformat(now()...

  • Page 538: Currency Output

    520 chapter 3 coldfusion functions lseurocurrencyformat description returns a currency value using the convention of the locale and the euro as the currency symbol. Default value is "local." category international functions syntax lseurocurrencyformat(currency-number [, type ]) see also lsparseeuroc...

  • Page 539

    Alphabetical list of coldfusion functions 521 english (canadian) local: € 100,000.00 international: eur100,000.00 none: 100,000.00 english (new zealand) local: € 100,000.00 international: eur100,000.00 none: 100,000.00 english (uk) local: € 100,000.00 international: eur100,000.00 none: 100,000.00 en...

  • Page 540

    522 chapter 3 coldfusion functions example lseurocurrencyformat returns a currency value using the locale convention. Default value is "local." index = "locale" delimiters = ","> #locale# local: #lseurocurrencyformat(100000, "local")# international: #lseurocurrencyformat(100000, "international")# no...

  • Page 541

    Alphabetical list of coldfusion functions 523 lsiscurrency description checks whether a string is a locale-specific currency string. Returns true if string is a currency string, false otherwise. Category international functions syntax lsiscurrency(string) parameters example is the value "#form.Myval...

  • Page 542

    524 chapter 3 coldfusion functions lsisdate description like the isdate function, lsisdate returns true if string can be converted to a date/time value in the current locale, false otherwise. Category international functions syntax lsisdate(string) parameters usage years less than 100 are interprete...

  • Page 543

    Alphabetical list of coldfusion functions 525 lsisnumeric description like the isnumeric function, lsisnumeric returns true if string can be converted to a number in the current locale; otherwise, false. Category international functions syntax lsisnumeric(string) parameters example is the value "#fo...

  • Page 544

    526 chapter 3 coldfusion functions lsnumberformat description formats a number using the locale convention. If mask is omitted, the number is formatted as an integer. Category international functions syntax lsnumberformat(number [, mask ]) parameters lsnumberformat mask characters the following tabl...

  • Page 545

    Alphabetical list of coldfusion functions 527 note if you do not specify a sign for the mask, positive and negative numbers do not align in columns. If you expect to display positive and negative numbers in your application, use a space or - (hyphen) to force a space in front of positive numbers and...

  • Page 546

    528 chapter 3 coldfusion functions example lsnumberformat returns a number value using the locale convention. Index = "locale" delimiters = ","> #locale# #lsnumberformat(-1234.5678, "_________")# #lsnumberformat(-1234.5678, "_________.___")# #lsnumberformat(1234.5678, "_________")# #lsnumberformat(1...

  • Page 547

    Alphabetical list of coldfusion functions 529 lsparsecurrency description converts a locale-specific currency string to a number. Attempts conversion through each of the default currency formats (none, local, international). Returns the number matching the value of string. Category international fun...

  • Page 548

    530 chapter 3 coldfusion functions french (standard) local: 100 000,00 f international: frf100 000,00 none: 100 000,00 french (swiss) local: sfr. 100’000.00 international: chf100’000.00 none: 100’000.00 german (austrian) local: ös 100.000,00 international: ats100.000,00 none: 100.000,00 german (stan...

  • Page 549

    Alphabetical list of coldfusion functions 531 example lsparsecurrency coverts a local-specific currency string to a number. Attempts conversion through each of the three default currency formats. Index = "locale" delimiters = ","> #locale# local: #lscurrencyformat(123456, "local")# currency number: ...

  • Page 550

    532 chapter 3 coldfusion functions lsparsedatetime description a locale-specific version of the parsedatetime function, except that there is no option for pop date/time object parsing. Returns a date/time object. International functions syntax lsparsedatetime(date/time-string) see also parsedatetime...

  • Page 551

    Alphabetical list of coldfusion functions 533 lsparsedatetime returns a locale-specific date/time object. Index = "locale" delimiters = ","> #locale# locale-specific formats: #lsdateformat(now(), "mmm-dd-yyyy")# #lstimeformat(now())# #lsdateformat(now(), "mmmm d, yyyy")# #lstimeformat(now())# #lsdat...

  • Page 552

    534 chapter 3 coldfusion functions lsparseeurocurrency description converts a locale-specific currency string that contains the euro symbol ( €) or sign (eur) to a number. Attempts conversion through each of the default currency formats (none, local, international). Returns the number that matches t...

  • Page 553

    Alphabetical list of coldfusion functions 535.

  • Page 554

    536 chapter 3 coldfusion functions lsparsenumber description converts a locale-specific string to a number. Returns the number that matches the value of string. Category international functions syntax lsparsenumber(string) parameters example lsparsenumber converts a locale-specific string to a numbe...

  • Page 555

    Alphabetical list of coldfusion functions 537 lstimeformat description returns a custom-formatted time value using the locale convention. Category international functions syntax lstimeformat(time [, mask ]) see also lsparsedatetime parameters usage when passing date/time value as a string, enclose i...

  • Page 556

    538 chapter 3 coldfusion functions #locale# #lstimeformat(now())# #lstimeformat(now(), ‘hh:mm:ss’)# #lstimeformat(now(), ‘hh:mm:sst’)# #lstimeformat(now(), ‘hh:mm:sstt’)# #lstimeformat(now(), ‘hh:mm:ss’)# #locale# #lstimeformat(now())# #lstimeformat(now(), ‘hh:mm:ss’)# #lstimeformat(now(), ‘hh:mm:ss...

  • Page 557

    Alphabetical list of coldfusion functions 539 ltrim description returns string with leading spaces removed. Category string functions syntax ltrim(string) see also rtrim , tobase64 parameters example ltrim example your string:"#form.Mytext#" your string:"#ltrim(form.Mytext)#" (left trimmed) type in ...

  • Page 558

    540 chapter 3 coldfusion functions max description returns the higher value of two numbers. Category date and time functions syntax max(number1, number2) see also min parameters example max example the maximum of the two numbers is #max(form.Mynum1, form.Mynum2)# the minimum of the two numbers is #m...

  • Page 559

    Alphabetical list of coldfusion functions 541 mid description returns count characters from string beginning at start position. Category date and time functions syntax mid(string, start, count) see also left , len , right parameters example mid example your string #form.Mytext# only has #len(form.My...

  • Page 560

    542 chapter 3 coldfusion functions min description returns the smaller, value of two numbers. Category date and time functions syntax min(number1, number2) see also max parameters example min example the maximum of the two numbers is #max(form.Mynum1, form.Mynum2)# the minimum of the two numbers is ...

  • Page 561

    Alphabetical list of coldfusion functions 543 minute description returns the ordinal for the minute, in the range 0–59. Category date and time functions syntax minute(date) see also datepart , hash , second parameters usage year values 0 - 29 are interpreted as 21 st century dates. Year values 30 - ...

  • Page 562

    544 chapter 3 coldfusion functions month description returns the ordinal for the month, ranging from 1 (january) to 12 (december). Category date and time functions syntax month(date) see also datepart , monthasstring , quarter parameters usage year values 0 - 29 are interpreted as 21 st century date...

  • Page 563

    Alphabetical list of coldfusion functions 545 monthasstring description returns the name of the month corresponding to month_number. Category date and time functions syntax monthasstring(month_number) see also datepart , month , quarter parameters example monthasstring example more information about...

  • Page 564

    546 chapter 3 coldfusion functions now description returns the current date and time of the computer running the coldfusion server. The date and time is in the form of a date/time object, which can be passed as a parameter to many date functions, such as daysinyear or firstdayofmonth . Category date...

  • Page 565

    Alphabetical list of coldfusion functions 547 numberformat description creates a custom-formatted number value. If no mask is specified, returns the value as an integer with a thousands separator. Numberformat supports the numeric formatting used in the u.S. For international number formatting, see ...

  • Page 566

    548 chapter 3 coldfusion functions note if you do not specify a sign for the mask, positive and negative numbers do not align in columns. If you expect to display positive and negative numbers in your application, use the space or - (minus sign) to force a space in front of positive numbers and a mi...

  • Page 567

    Alphabetical list of coldfusion functions 549 when converting string to double, this function adds a rounding factor of 1.5543122344752e-014 to the converted number to prevent rounding errors. For example, without adding the rounding factor, converting the string value 1.275 to double with two digit...

  • Page 568

    550 chapter 3 coldfusion functions paragraphformat description returns string with converted single newline characters (cr/lf sequences) into spaces and double newline characters into html paragraph markers ( ). Category display and formatting functions syntax paragraphformat(string) see also stripc...

  • Page 569

    Alphabetical list of coldfusion functions 551 parameterexists description returns true if the specified parameter has been passed to the current template or has already been created during execution of the current template. Otherwise returns no. This function is provided for backward compatibility w...

  • Page 570

    552 chapter 3 coldfusion functions parsedatetime description returns a date/time object from a string. Parsedatetime converts date/time strings that are in the u.S. Date format. Use lsparsedatetime for international date parsing. Category date and time functions syntax parsedatetime(date/time-string...

  • Page 571

    Alphabetical list of coldfusion functions 553 is a valid date the date, parsed for use as a date/time value: #parsedatetime(form.Thetestvalue)# ....

  • Page 572

    554 chapter 3 coldfusion functions pi description returns the number 3.14159265358979, the mathematical constant π , accurate to 15 digits. Category mathematical functions syntax pi() see also asin , cos , sin , tan example pi example returns the number #numberformat(pi(), ‘_._______________’)# , th...

  • Page 573

    Alphabetical list of coldfusion functions 555 preservesinglequotes description prevents coldfusion from automatically "escaping" single quotes contained in variable. Category other functions syntax preservesinglequotes(variable) parameters usage preservesinglequotes is useful in sql statements. Exam...

  • Page 574

    556 chapter 3 coldfusion functions quarter description quarter calculates and returns an integer (1–4) of the year quarter in which the date falls. Category date and time functions syntax quarter(date) see also datepart , month parameters usage year values 0 - 29 are interpreted as 21 st century dat...

  • Page 575

    Alphabetical list of coldfusion functions 557 queryaddcolumn description adds a new column to a specified query and populates the column’s rows with the contents of a one-dimensional array. Returns the number of the column that has been added. Padding is added, if necessary, on the query columns to ...

  • Page 576

    558 chapter 3 coldfusion functions after populating the query, the example shows, in tabular format, the contents of the columns. Fastfoodarray)> finecuisinearray)> healthfoodarray)> fast food fine cuisine health food #fastfood# #finecuisine# #healthfood# note: because there are fewer elements in th...

  • Page 577

    Alphabetical list of coldfusion functions 559 queryaddrow description adds a specified number of empty rows to a query. Returns the total number of rows in the query that you are adding rows to. Category query functions syntax queryaddrow(query [, number ]) see also queryaddcolumn , queryaddrow , qu...

  • Page 578

    560 chapter 3 coldfusion functions querynew description returns an empty query with a set of columns or an empty query. See usage for more information. Category query functions syntax querynew(columnlist) see also queryaddcolumn , queryaddrow , querysetcell parameters usage if you specify an empty s...

  • Page 579

    Alphabetical list of coldfusion functions 561 querysetcell description sets the cell in a column to a value. If no row number is specified, the cell on the last row is set. Returns true. Category query functions syntax querysetcell(query, column_name, value [, row_number ]) see also queryaddcolumn ,...

  • Page 580

    562 chapter 3 coldfusion functions after the queryaddrow action, the query has #getcourses.Recordcount# records..

  • Page 581

    Alphabetical list of coldfusion functions 563 quotedvaluelist description returns a comma-separated list of the values of each record returned from a previously executed query. Each value in the list is enclosed in single quotes. Category query functions syntax quotedvaluelist(query.Column [, delimi...

  • Page 582

    564 chapter 3 coldfusion functions rand description returns a random decimal number in the range 0 - 1. Category mathematical functions syntax rand() see also randomize , randrange usage to ensure greater randomness, call randomize before calling rand . Example rand example rand() returns a random n...

  • Page 583

    Alphabetical list of coldfusion functions 565 randomize description seeds the random number generator in coldfusion with the integer part of a number. By seeding the generator with a variable value, you help ensure that the rand function generates highly random numbers. Category mathematical functio...

  • Page 584

    566 chapter 3 coldfusion functions randrange description returns a random integer between two specified numbers. Requests for random integers greater than 100,000,000 result in nonrandom behavior. This restriction prevents overflow during internal computations. Category mathematical functions syntax...

  • Page 585

    Alphabetical list of coldfusion functions 567 refind description returns the position of the first occurrence of a regular expression in a string starting from a specified position. Returns 0 if no occurrences are found. The search is case sensitive. Returns the position and length of the first occu...

  • Page 586

    568 chapter 3 coldfusion functions example refind example this example shows the use of the refind function with and without the returnsubexpressions parameter set to true. If you do not use the returnsubexpressions parameter, refind returns the position of the first occurrence of a regular expressi...

  • Page 587

    Alphabetical list of coldfusion functions 569 the number of elements in the pos and len arrays is always one if you do not use parentheses in the regular expression. The value of st.Pos[1] is: #st.Pos[1]#. The value of st.Len[1] is: #st.Len[1]#. Substring is [#mid(teststring,st.Pos[1],st.Len[1])#] h...

  • Page 588

    570 chapter 3 coldfusion functions refindnocase description returns the position of the first occurrence of a regular expression in a string starting from a specified position, if the returnsubexpressions parameter is not set to true. Returns 0 if no occurrences are found. The search is case-insensi...

  • Page 589

    Alphabetical list of coldfusion functions 571 the regular expression in the first element of the respective arrays; the position and length of the first instance of each subexpression within the regular expression are returned in subsequent array elements. Example refindnocase example this example d...

  • Page 590

    572 chapter 3 coldfusion functions to create this structure you can use a cfset statement, for example: the number of elements in each array: #arraylen(st.Pos)#. The number of elements in the pos and len arrays will always be one if you do not use parentheses to denote subexpressions in the regular ...

  • Page 591

    Alphabetical list of coldfusion functions 573 removechars description returns string with count characters removed from a specified starting position. Return 0 if no characters are found. Category string functions syntax removechars(string, start, count) see also insert , len parameters example remo...

  • Page 592

    574 chapter 3 coldfusion functions repeatstring description returns a string created from string repeated a specified number of times. Category string functions syntax repeatstring(string, count) see also cjustify , ljustify , rjustify parameters example repeatstring example repeatstring returns a s...

  • Page 593

    Alphabetical list of coldfusion functions 575 replace description returns string with occurrences of substring1 replaced with substring2 in a specified scope. Category string functions syntax replace(string, substring1, substring2 [, scope ]) see also refind , replacenocase , replacelist , rereplace...

  • Page 594

    576 chapter 3 coldfusion functions replacelist description returns string with occurrences of the elements from a specified comma-delimited list replaced with corresponding elements from another comma-delimited list. The search is case-sensitive. Category string functions syntax replacelist(string, ...

  • Page 595

    Alphabetical list of coldfusion functions 577 substring 1 (find this list of substrings) substring 2 (replace with this list of substrings) "mysubstring2">.

  • Page 596

    578 chapter 3 coldfusion functions replacenocase description returns string with occurrences of substring1 replaced, regardless of case, matching with substring2 in the specified scope. Category string functions syntax replacenocase(string, substring1, substring2 [, scope ]) see also refind , replac...

  • Page 597

    Alphabetical list of coldfusion functions 579 rereplace description returns string with a regular expression replaced with substring in the specified scope. This is a case-sensitive search. Category string functions syntax rereplace(string, reg_expression, substring [, scope ]) see also refind , rep...

  • Page 598

    580 chapter 3 coldfusion functions rereplacenocase description returns string with a regular expression replaced with substring in the specified scope. The search is case-insensitive. Category string functions syntax rereplacenocase(string, reg_expression, substring [, scope ]) see also refind , ref...

  • Page 599

    Alphabetical list of coldfusion functions 581 reverse description returns string with reversed order of characters. Category string functions syntax reverse(string) see also left , mid , right parameters example reverse example reverse returns your string with the positions of the characters reverse...

  • Page 600

    582 chapter 3 coldfusion functions right description returns the rightmost count characters of a string. Category string functions syntax right(string, count) see also mid , left , reverse parameters example your string #form.Mytext# only has #len(form.Mytext)# characters. You cannot output the #for...

  • Page 601

    Alphabetical list of coldfusion functions 583 rjustify description returns right-justified string in the specified field length. Category string functions syntax rjustify(string, length) see also cjustify , ljustify parameters example rjustify example enter a string, and it will be right justified w...

  • Page 602

    584 chapter 3 coldfusion functions round description rounds a number to the closest integer. Category mathematical functions syntax round(number) see also ceiling , fix , int parameters example round example this function rounds a number to the closest integer. #evaluate(round(1.2345*100)/100)# para...

  • Page 603

    Alphabetical list of coldfusion functions 585 rtrim description returns string with trailing spaces removed. Category string functions syntax rtrim(string) see also ltrim , trim parameters example rtrim example your string:"#form.Mytext#" your string:"#rtrim(form.Mytext)#" (right trimmed) type in so...

  • Page 604

    586 chapter 3 coldfusion functions second description for a date/time value, returns the ordinal for the second, an integer 0–59. Category date and time functions syntax second(date) see also datepart , hash , minute parameters usage when passing a date/time value as a string, enclose it in quotes. ...

  • Page 605

    Alphabetical list of coldfusion functions 587 setlocale description sets a locale for the current session. Category international functions syntax setlocale(new_locale) see also gethttptimestring , getlocale parameters usage setlocale can be used to restore a previous locale setting by referencing a...

  • Page 606

    588 chapter 3 coldfusion functions setlocale sets the locale to the specified new locale for the current session. A locale is an encapsulation of the set of attributes that govern the display and formatting of international date, time, number, and currency values. The locale for this system is #getl...

  • Page 607

    Alphabetical list of coldfusion functions 589 setprofilestring description sets the value of a profile entry in an initialization file. The function returns an empty string if the operation succeeds, or an error message if the operation fails. Category system functions syntax setprofilestring(inipat...

  • Page 608

    590 chapter 3 coldfusion functions setting the timeout value to #mytimeout# section, "timeout", mytimeout)> value returned from setprofilestring: #code# section, "timeout", mytimeout)> value returned from setprofilestring: #code# timeout value should be greater than zero in order to provide time for...

  • Page 609

    Alphabetical list of coldfusion functions 591 setvariable description sets the variable specified by name to value; returns the new value of the variable. Category dynamic evaluation functions syntax setvariable(name, value) see also deleteclientvariable , getclientvariableslist parameters usage the...

  • Page 610

    592 chapter 3 coldfusion functions your variable, #varname# the value of #varname# is #varnamevalue# ....

  • Page 611

    Alphabetical list of coldfusion functions 593 sgn description determines the sign of a number. Returns 1 if number is positive; 0 if number is 0; -1 if number is negative. Category mathematical functions syntax sgn(number) see also abs parameters example sgn determines the sign of a number. Returns ...

  • Page 612

    594 chapter 3 coldfusion functions sin description returns the sine of an angle. Category mathematical functions syntax sin(number) see also asin , atn , cos , pi , tan parameters example sin example sin(#form.Sinnum#) = #sin(form.Sinnum)# degrees = #evaluate(sin(form.Sinnum) * pi()/180)# radians ty...

  • Page 613

    Alphabetical list of coldfusion functions 595 spanexcluding description returns all characters from string, from the beginning to a character from the set of characters. The search is case-sensitive. Category string functions syntax spanexcluding(string, set) see also gettoken , spanincluding parame...

  • Page 614

    596 chapter 3 coldfusion functions spanincluding description returns all characters from string, from the beginning to a character that is not in the set of characters. The search is case-sensitive. Category string functions syntax spanincluding(string, set) see also gettoken , spanexcluding paramet...

  • Page 615

    Alphabetical list of coldfusion functions 597 sqr description returns a positive square root. Category mathematical functions syntax sqr(number) see also abs parameters usage number must be greater than or equal to 0. Example sqr example returns a positive square root of a number. Sqr(2):#sqr(2)# sq...

  • Page 616

    598 chapter 3 coldfusion functions stripcr description returns string with carriage return characters removed. Category other functions syntax stripcr(string) see also paragraphformat parameters usage useful for preformatted html display of data (pre) entered into textarea fields. Example function s...

  • Page 617

    Alphabetical list of coldfusion functions 599 structappend description appends one structure to another. Always returns yes. Syntax structappend(struct1, struct2, overwriteflag) see also structdelete , structfind , structget , structinsert , structisempty , structkeyarray , structkeyexists , structk...

  • Page 618

    600 chapter 3 coldfusion functions the person struct after the append call: #myitem#.

  • Page 619

    Alphabetical list of coldfusion functions 601 structclear description removes all data from the specified structure. Always returns yes. Syntax structclear(structure) see also structdelete , structfind , structinsert , structisempty , structkeyarray , structkeyexists , structkeylist , structcount , ...

  • Page 620

    602 chapter 3 coldfusion functions structcopy description returns a new structure with the keys and values of a structure. Category structure functions syntax structcopy(structure) see also duplicate , structclear , structfind , structinsert , structisempty , structkeyarray , structkeyexists , struc...

  • Page 621

    Alphabetical list of coldfusion functions 603 example // this script creates a structure that structcopy copies by value. // create elements. S = structnew(); s.Array = arraynew(2); // assign simple values to original top-level structure fields. S.Number = 99; s.String = "hello tommy"; // assign val...

  • Page 622

    604 chapter 3 coldfusion functions s.Number = #s.Number# s.String = #s.String# // array value s.Array[1][1] = #s.Array[1][1]# s.Array[1][2] = #s.Array[1][2]# copied structure values should be the same as the original. // simple values copied.Number = #copied.Number# copied.String = #copied.String# /...

  • Page 623

    Alphabetical list of coldfusion functions 605 // change the values of the original structure. S.Nested.Number = 100; s.Nested.String = "hello tommy (modified)"; s.Nested.Array[1][1] = "one one (modified)"; s.Nested.Array[1][2] = "one two (modified)"; modified original values // simple values s.Neste...

  • Page 624

    606 chapter 3 coldfusion functions structcount description returns the number of keys in a structure. Category structure functions see also structclear , structfind , structinsert , structisempty , structkeyarray , structkeyexists , structkeylist , structcount , structnew , structupdate , structappe...

  • Page 625

    Alphabetical list of coldfusion functions 607 structdelete description removes an item from a structure. Category structure functions syntax structdelete(structure, key [, indicatenotexisting ]) see also structclear , structfind , structinsert , structisempty , structkeyarray , structkeyexists , str...

  • Page 626

    608 chapter 3 coldfusion functions employee is a structure: #isstruct(employee)# did i delete the field "#form.Field#"? The code indicates: #rc# select the field to be deleted: first name last name email phone department.

  • Page 627

    Alphabetical list of coldfusion functions 609 structfind description returns the value associated with a key in a structure. Category structure functions syntax structfind(structure, key) see also structclear , structdelete , structinsert , structisempty , structkeyarray , structkeyexists , structke...

  • Page 628

    610 chapter 3 coldfusion functions structfindkey description searches recursively through a sub-structure of nested arrays, structures, and other elements and returns an array containing any structures with values that match the search key specified in the value parameter. Syntax structfindkey(top, ...

  • Page 629

    Alphabetical list of coldfusion functions 611 structfindvalue description searches recursively through a sub-structure of nested arrays, structures, and other elements and returns an array containing any structures with values that match the search key specified in the value parameter. Syntax struct...

  • Page 630

    612 chapter 3 coldfusion functions structget description returns an array of structures from the specified path. Syntax structget(pathdesired) see also structdelete , structfind , structappend , structinsert , structisempty , structkeyarray , structkeyexists , structkeylist , structcount , structnew...

  • Page 631

    Alphabetical list of coldfusion functions 613 structinsert description inserts a key-value pair into a structure. Returns yes if the insert was successful and no if an error occurs. Category structure functions syntax structinsert(structure, key, value [, allowoverwrite ]) see also structclear , str...

  • Page 632

    614 chapter 3 coldfusion functions structinsert(employee, "department", form.Department); first name is #structfind(employee, "firstname")# last name is #structfind(employee, "lastname")# email is #structfind(employee, "email")# phone is #structfind(employee, "phone")# department is #structfind(empl...

  • Page 633

    Alphabetical list of coldfusion functions 615 structisempty description indicates whether a structure contains data. Returns true if structure is empty. Category structure functions syntax structisempty(structure) see also structclear , structdelete , structfind , structinsert , structkeyarray , str...

  • Page 634

    616 chapter 3 coldfusion functions structkeyarray description returns an array of the keys in a coldfusion structure. Category structure functions syntax structkeyarray(structure) see also structclear , structdelete , structfind , structinsert , structisempty , structkeyexists , structkeylist , stru...

  • Page 635

    Alphabetical list of coldfusion functions 617 this example uses the structnew function to create a structure that supplies employee information. The data structure is called "employee" and its fields are filled with the contents of the following form. After you have entered employee information into...

  • Page 636

    618 chapter 3 coldfusion functions key#i# is #keystostruct[i]# value#i# is #employee[keystostruct[i]]#.

  • Page 637

    Alphabetical list of coldfusion functions 619 structkeyexists description returns true if a key is in a structure and false if it is not. Category structure functions syntax structkeyexists(structure, key) see also structclear , structdelete , structfind , structinsert , structisempty , structkeyarr...

  • Page 638

    620 chapter 3 coldfusion functions structkeylist description returns the list of keys in a coldfusion structure. Category structure functions syntax structkeylist(structure, [delimiter]) see also structclear , structdelete , structfind , structinsert , structisempty , structkeyarray , structcount , ...

  • Page 639

    Alphabetical list of coldfusion functions 621 this example uses the structnew function to create a structure that supplies employee information. The data structure is called "employee" and its fields are filled with the contents of the following form. After you have entered employee information into...

  • Page 640

    622 chapter 3 coldfusion functions ")> here are the keys to the structure: #keystostruct# if these fields are correct, we can process your new employee information. If they are not correct, you should consider rewriting your application..

  • Page 641

    Alphabetical list of coldfusion functions 623 structnew description returns a new structure. Category structure functions syntax structnew() see also structclear , structdelete , structfind , structinsert , structisempty , structkeyarray , structcount , structupdate , structappend , structget , stru...

  • Page 642

    624 chapter 3 coldfusion functions structsort description returns an array of structures containing top-level key names (strings) sorted according to the value of the specified subelement. The value of the keys may be simple values or complex elements. Syntax structsort( base, pathtosubelement, sort...

  • Page 643

    Alphabetical list of coldfusion functions 625 list of employees based on the salary (text search): 1) #arraytolist( structsort( salaries ) )# 2) #arraytolist( structsort( salaries ) )# 3) #arraytolist( structsort( salaries, "text", "asc" ) )# 4) #arraytolist( structsort( salaries, "textnocase", "asc...

  • Page 644

    626 chapter 3 coldfusion functions structupdate description updates a key with a value. Returns yes if the function is successful and throws an exception if an error occurs. Category structure functions syntax structupdate(structure, key, value) see also structclear , structdelete , structfind , str...

  • Page 645

    Alphabetical list of coldfusion functions 627 tan description returns the tangent of an angle. Category mathematical functions syntax tan(number) see also atn , asin , cos , sin , and pi parameters example tan example returns the tangent of a given angle. Tan(1): #tan(1)# tan(pi()/4): #tan(pi()/4)# ...

  • Page 646

    628 chapter 3 coldfusion functions timeformat description returns a custom-formatted time value. If no mask is specified, returns a time value using the hh:mm tt format. For international time formatting, see lstimeformat . Category date and time functions syntax timeformat(time [, mask ]) see also ...

  • Page 647

    Alphabetical list of coldfusion functions 629.

  • Page 648

    630 chapter 3 coldfusion functions tobase64 description returns the base64 representation of the string or binary object. Base64 is a format that uses printable characters, allowing binary data to be sent in forms and e-mail, and stored in a database or file. Category conversion functions syntax tob...

  • Page 649

    Alphabetical list of coldfusion functions 631 the following string is the concatenation of all characters (32 to 255) from the ascii table. #chardata#.

  • Page 650

    632 chapter 3 coldfusion functions tobinary description returns the binary representation of base64 encoded data. Category conversion functions syntax tobinary(string_in_base64 or binary_value) see also see: • cffile for information about loading and reading binary data • cfwddx for information abou...

  • Page 651

    Alphabetical list of coldfusion functions 633 the following string is the concatenation of all characters (32 to 255) from the ascii table. #chardata# representation of string data..

  • Page 652

    634 chapter 3 coldfusion functions tostring description attempts to convert a value of any type, including a binary value, into a string. Category conversion functions syntax tostring(any_value) parameters usage if tostring cannot convert the value into a string, it throws an exception. Simple value...

  • Page 653

    Alphabetical list of coldfusion functions 635 the following string is the base64 representation of the original string. #data64# the following is the string representation of the binary data. #datastring#.

  • Page 654

    636 chapter 3 coldfusion functions trim description returns string with leading and trailing spaces removed. Category string functions syntax trim(string) see also ltrim , rtrim parameters example trim example your string:"#form.Mytext#" your string:"#trim(form.Mytext)#" (trimmed on both sides) type...

  • Page 655

    Alphabetical list of coldfusion functions 637 ucase description returns string converted to uppercase. Category string functions syntax ucase(string) see also lcase parameters example ucase example your text, #form.Sampletext#, returned in uppercase is #ucase(form.Sampletext)# . Please enter some te...

  • Page 656

    638 chapter 3 coldfusion functions urldecode description decodes a url-encoded string. Category other functions syntax urldecode(urlencodedstring) see also urlencodedformat parameters usage url encoding is a data format in which high ascii and nonalphanumeric characters are encoded using a percent s...

  • Page 657

    Alphabetical list of coldfusion functions 639 urlencodedformat description returns a url-encoded string. Spaces are replaced with %20, and nonalphanumeric characters with equivalent hexadecimal escape sequences. The function lets you pass arbitrary strings within a url, because coldfusion automatica...

  • Page 658

    640 chapter 3 coldfusion functions val description returns a number that the beginning of a string can be converted to. Returns 0 if conversion is not possible. Category string functions syntax val(string) see also isnumeric parameters example val example can be converted to a number: #val(form.Thet...

  • Page 659

    Alphabetical list of coldfusion functions 641 valuelist description returns a comma-separated list of the values of each record returned from a previously executed query. Category other functions syntax valuelist(query.Column [, delimiter ]) see also quotedvaluelist parameters example select dept_id...

  • Page 660

    642 chapter 3 coldfusion functions week description returns the ordinal for the week number in a year; an integer in the range 1–53. Category date and time functions syntax week(date) see also datepart parameters usage year values 0–29 are interpreted as 21 st century dates. Year values 30–99 are in...

  • Page 661

    Alphabetical list of coldfusion functions 643 writeoutput description appends text to the page output stream. Although you can call this function anywhere within a page, it is most useful inside a cfscript block. This function writes to the page output stream regardless of conditions established by ...

  • Page 662

    644 chapter 3 coldfusion functions xmlformat description returns a string that is safe to use with xml. Category conversion functions syntax xmlformat(string) parameters usage xmlformat escapes special xml characters so that you can put arbitrary strings safely into xml. The characters that are esca...

  • Page 663

    Alphabetical list of coldfusion functions 645 year description returns the year corresponding to date. Category date and time functions syntax year(date) parameters see also datepart , isleapyear usage year values 0–29 are interpreted as 21 st century dates. Year values 30–99 are interpreted as 20 t...

  • Page 664

    646 chapter 3 coldfusion functions yesnoformat description returns boolean data as yes or no. Category decision functions syntax yesnoformat(value) parameters see also isbinary , isnumeric usage the yesnoformat function returns non-zero values as yes and zero values as no. Example the yesnoformat fu...

  • Page 665: Coldfusion C++ Cfx

    Chapter 4 coldfusion c++ cfx reference this chapter describes the cfxapi classes and members. Contents • c++ class overview................................................................................................. 648 • ccfxexception class.........................................................

  • Page 666: C++ Class Overview

    648 chapter 4 coldfusion c++ cfx reference c++ class overview a list of cfxapi classes and members follows. Members are described in detail in the following sections. Class members ccfxexception class ccfxexception::geterror ccfxexception::getdiagnostics ccfxquery class ccfxquery::addrow ccfxquery::...

  • Page 667: Ccfxexception Class

    Ccfxexception class 649 ccfxexception class an abstract class that represents an exception thrown during processing of a coldfusion extension (cfx) procedure. Exceptions of this type can be thrown by ccfxrequest class , ccfxquery class , and ccfxstringset class . Your coldfusion extension code must ...

  • Page 668

    650 chapter 4 coldfusion c++ cfx reference // this prevents the server from crashing in // case of an unexpected exception) catch( ... ) { prequest->throwexception( "error occurred in tag cfx_foo2", "unexpected error occurred while processing tag." ) ; }.

  • Page 669: Ccfxquery Class

    Ccfxquery class 651 ccfxquery class an abstract class that represents a query used or created by a coldfusion extension (cfx). Queries contain one or more columns of data that extend over a varying number of rows. Class members virtual int addrow() ccfxquery::addrow adds a row to a query. Virtual in...

  • Page 670: Ccfxquery::getcolumns

    652 chapter 4 coldfusion c++ cfx reference // second row irow = pquery->addrow() ; pquery->setdata( irow, icity, "st. Paul" ) ; pquery->setdata( irow, istate, "mn" ) ; pquery->setdata( irow, izip, "55105" ) ; ccfxquery::getcolumns syntax ccfxstringset* ccfxquery::getcolumns(void) description retriev...

  • Page 671: Ccfxquery::getname

    Ccfxquery class 653 int irow, icol ; int nnumcols = pquery->getcolumns()->getcount() ; int nnumrows = pquery->getrowcount() ; for ( irow=1; irow { for ( icol=1; icol { prequest->write( pquery->getdata( irow, icol ) ) ; prequest->write( " " ) ; } prequest->write( "" ) ; } ccfxquery::getname syntax lp...

  • Page 672: Ccfxquery::setquerystring

    654 chapter 4 coldfusion c++ cfx reference parameters example the following example shows the addition of two rows to a three-column (’city’, ’state’, and ’zip’) query: // first row int irow ; irow = pquery->addrow() ; pquery->setdata( icity, irow, "minneapolis" ) ; pquery->setdata( istate, irow, "m...

  • Page 673: Ccfxrequest Class

    Ccfxrequest class 655 ccfxrequest class abstract class that represents a request made to a coldfusion extension (cfx). An instance of this class is passed to the main function of your extension dll. The class provides several interfaces that can be used by the custom extension, including functions f...

  • Page 674: Ccfxrequest::addquery

    656 chapter 4 coldfusion c++ cfx reference virtual void setcustomdata( lpvoid lpvdata ) ccfxrequest::setcustomdata sets custom (tag specific) data to carry with a request. Virtual lpvoid getcustomdata() ccfxrequest::getcustomdata gets custom (tag specific) data for a request. Ccfxrequest::addquery s...

  • Page 675: Ccfxrequest::createstringset

    Ccfxrequest class 657 description checks whether the attribute was passed to the tag. Returns true if the attribute is available; otherwise, returns false. Parameters example the following example checks whether the user passed an attribute named destination to the tag, and throws an exception if th...

  • Page 676: Ccfxrequest::getattribute

    658 chapter 4 coldfusion c++ cfx reference ccfxrequest::getattribute syntax lpcstr ccfxrequest::getattribute(lpcstr lpszname) description retrieves the value of the passed attribute. Returns an empty string if the attribute does not exist. (to test whether an attribute was passed to the tag, use ccf...

  • Page 677: Ccfxrequest::getcustomdata

    Ccfxrequest class 659 ccfxrequest::getcustomdata syntax lpvoid ccfxrequest::getcustomdata(void) description gets the custom (tag specific) data for the request. This member is typically used from within subroutines of a tag implementation to extract tag data from a request. Returns returns a pointer...

  • Page 678

    660 chapter 4 coldfusion c++ cfx reference returns returns the value of the custom tag setting. If no setting of that name exists, an empty string is returned. Parameters example the following example retrieves the value of a setting named ’verifyaddress’ and uses the returned value to determine the...

  • Page 679: Ccfxrequest::setcustomdata

    Ccfxrequest class 661 ccfxrequest::setcustomdata syntax void ccfxrequest::setcustomdata(lpvoid lpvdata) description sets custom (tag specific) data to carry with the request. Use this function to store request specific data to pass to procedures within your custom tag implementation. Parameters exam...

  • Page 680: Ccfxrequest::throwexception

    662 chapter 4 coldfusion c++ cfx reference ccfxrequest::throwexception syntax void ccfxrequest::throwexception(lpcstr lpszerror, lpcstr lpszdiagnostics) description throws an exception and ends processing of a request. Call this function when you encounter an error that does not allow you to continu...

  • Page 681: Ccfxrequest::writedebug

    Ccfxrequest class 663 ccfxrequest::writedebug syntax void ccfxrequest::writedebug(lpcstr lpszoutput) description writes text output into the debug stream. The text is only displayed to the end-user if the tag contains the debug attribute. (for more information, see ccfxrequest::debug .) parameters e...

  • Page 682: Ccfxstringset Class

    664 chapter 4 coldfusion c++ cfx reference ccfxstringset class abstract class that represents a set of ordered strings. Strings can be added to a set and can be retrieved by a numeric index (index values for strings are 1-based). To create a string set, use ccfxrequest::createstringset . Class membe...

  • Page 683: Ccfxstringset::getstring

    Ccfxstringset class 665 example the following example demonstrates using getcount with ccfxstringset::getstring to iterate over a string set and write the contents of the list back to the user: int nnumitems = pstringset->getcount() ; for ( int i=1; i { prequest->write( pstringset->getstring( i ) ) ...

  • Page 684

    666 chapter 4 coldfusion c++ cfx reference example the following example demonstrates getstring with ccfxstringset::getcount to iterate over a string set and write the contents of a list back to the user: int nnumitems = pstringset->getcount() ; for ( int i=1; i { prequest->write( pstringset->getstr...

  • Page 685: Coldfusion Java Cfx

    Chapter 5 coldfusion java cfx reference this chapter describes the java interfaces available for building coldfusion custom cfxs in java. Contents • customtag interface ............................................................................................... 669 • query interface.................

  • Page 686: Overview Class Libraries

    668 chapter 5 coldfusion java cfx reference overview class libraries the following java interfaces are available for building coldfusion custom cfxs in java. Interface methods customtag interface processrequest query interface addrow getcolumnindex getcolumns getdata getname getrowcount setdata requ...

  • Page 687: Customtag Interface

    Customtag interface 669 customtag interface public abstract interface customtag interface for implementing custom tags. Classes that implement this interface can be specified in the class attribute of the java cfx tag. For example, in a class mycustomtag, which implements this interface, the followi...

  • Page 688: Query Interface

    670 chapter 5 coldfusion java cfx reference query interface public abstract interface query interface to a query used or created by a customtag. A query contains tabular data organized by named columns and rows. Methods addrow description adds a row to a query. Call this method to append a row to a ...

  • Page 689: Getcolumnindex

    Query interface 671 query.Setdata( irow, istate, "mn" ) ; query.Setdata( irow, izip, "55105" ) ; getcolumnindex description returns the index of the column, or -1 if no such column exists. Category query interface syntax public int getcolumnindex(string name) see also getcolumns , getdata parameters...

  • Page 690: Getdata

    672 chapter 5 coldfusion java cfx reference getdata description retrieves a data element from a row and column of a query. Row and column indexes begin with 1. You can find the number of rows in a query by calling getrowcount . You can find the number of columns in a query by calling getcolumns . Re...

  • Page 691: Getrowcount

    Query interface 673 getrowcount description retrieves the number of rows in a query. Returns the number of rows contained in a query. Category query interface syntax public int getrowcount() example the following example retrieves the number of rows in a query and writes it back to the user: query q...

  • Page 692

    674 chapter 5 coldfusion java cfx reference // second row irow = query.Addrow() ; query.Setdata( irow, icity, "st. Paul" ) ; query.Setdata( irow, istate, "mn" ) ; query.Setdata( irow, izip, "55105" ) ;.

  • Page 693: Request Interface

    Request interface 675 request interface public abstract interface request interface to a request made to a customtag. The interface includes methods for retrieving attributes passed to the tag (including queries) and reading global tag settings. Methods attributeexists description checks whether the...

  • Page 694: Debug

    676 chapter 5 coldfusion java cfx reference example the following example checks whether the user passed an attribute named destination to the tag; if not, it throws an exception: if ( ! Request.Attributeexists("destination") ) { throw new exception( "missing destination parameter", "you must pass a...

  • Page 695: Getattributelist

    Request interface 677 example the following example retrieves an attribute named destination and writes its value back to the user: string strdestination = request.Getattribute("destination") ; response.Write( "the destination is: " + strdestination ) ; getattributelist description retrieves a list ...

  • Page 696: Getquery

    678 chapter 5 coldfusion java cfx reference parameters example the following example retrieves an attribute named port and writes its value back to the user: int nport = request.Getintattribute("port") ; if ( nport != -1 ) response.Write( "the port is: " + string.Valueof(nport) ) ; getquery descript...

  • Page 697

    Request interface 679 parameters usage all custom tags implemented in java share a registry key for storing settings. To avoid name conflicts, preface the names of settings with the name of your customtag class. For example, the code below retrieves the value of a setting named ’verifyaddress’ for a...

  • Page 698: Response Interface

    680 chapter 5 coldfusion java cfx reference response interface public abstract interface response interface to response generated from a customtag. This interface includes methods for writing output, generating queries, and setting variables in the calling page. Methods addquery description adds a q...

  • Page 699: Setvariable

    Response interface 681 // create a query which contains these columns query query = response.Addquery( "people", columns ) ; // add data to the query int irow = query.Addrow() ; query.Setdata( irow, ifirstname, "john" ) ; query.Setdata( irow, ilastname, "smith" ) ; irow = query.Addrow() ; query.Setd...

  • Page 700: Writedebug

    682 chapter 5 coldfusion java cfx reference syntax public void write(string output) parameters example the following example outputs the value of the destination attribute: response.Write( "destination = " + request.Getattribute("destination") ) ; writedebug description writes text output into the d...

  • Page 701: Debugrequest

    Debugging classes reference 683 debugging classes reference the constructors and methods supported by the debugrequest , debugresponse , and debugquery classes are as follows. These classes also support the other methods of the request , response , and query interfaces, respectively. Debugrequest //...

  • Page 702

    684 chapter 5 coldfusion java cfx reference.

  • Page 703: Wddx Javascript Objects

    Chapter 6 wddx javascript objects this chapter provides information about javascript objects and functions used when implementing wddx in a coldfusion application. Contents • wddxserializer object............................................................................................. 687 • wddx...

  • Page 704: Javascript Object Overview

    686 chapter 6 wddx javascript objects javascript object overview below is a list of javascript objects and functions. Functions are described in detail in the following sections. Class members wddxserializer object serialize serializevariable serializevalue write wddxrecordset object addcolumn addro...

  • Page 705: Wddxserializer Object

    Wddxserializer object 687 wddxserializer object the wddxserializer object includes functions that serialize any javascript data structure. Functions the only function that developers typically call is serialize . Serialize description creates a wddx packet for a passed wddxrecordset instance. Syntax...

  • Page 706: Serializevariable

    688 chapter 6 wddx javascript objects { alert("couldn’t serialize data"); } } serializevariable description serializes a property of a structure. If an object is not a string, number, array, boolean, or date, wddxserializer treats it as a structure. Syntax object. Serializevariable ( name, obj ) par...

  • Page 707: Write

    Wddxserializer object 689 this function serializes null values as empty strings. Syntax object. Serializevalue ( obj ) parameters return value returns a boolean true if obj was serialized successfully; or false if an error occurs. Usage this is an internal function; you do not typically call it. Exa...

  • Page 708

    690 chapter 6 wddx javascript objects // number value this.Write("" + obj + ""); } else if (typeof(obj) == "boolean") { // boolean value this.Write(""); } ....

  • Page 709: Wddxrecordset Object

    Wddxrecordset object 691 wddxrecordset object includes functions that you call as needed when constructing a wddx recordset. Functions : addcolumn description adds a column to all rows in a wddxrecordset instance. Syntax object. Addcolumn ( name ) parameters return value none. Usage adds a column to...

  • Page 710: Addrows

    692 chapter 6 wddx javascript objects addrows description adds rows to all columns in a wddxrecordset instance. Syntax object. Addrows ( n ) parameters return value none. Usage this function adds the specified number of rows to every column of a wddx record set. Initially, the row/column values are ...

  • Page 711: Getrowcount

    Wddxrecordset object 693 example this example calls the getfield function (the variable r is a reference to a wddxrecordset instance): for (row = 0; row { o += " for (i = 0; i { o += " } o += " } getrowcount description indicates the number of rows in a wddxrecordset instance. Syntax object. Getrowc...

  • Page 712: Wddxserialize

    694 chapter 6 wddx javascript objects return value none. Usage call this function to set a value in a wddxrecordset instance. Example this example calls the setfield function: // create a new recordset rs = new wddxrecordset(); // add a new column rs.Addcolumn("newcolumn"); // extend the recordset b...

  • Page 713

    Wddxrecordset object 695 // object knows how to serialize itself bsuccess = obj.Wddxserialize(this); } ....

  • Page 714

    696 chapter 6 wddx javascript objects.