User Guide
cfparam 265
cfparam
Description
Tests for a parameter’s existence, tests its data type, and, if a default value is not assigned,
optionally provides one.
Category
Variable manipulation tags
Syntax
<cfparam
name = "param_name"
type = "data_type"
default = "value">
See also
cfcookie, cfregistry, cfsavecontent, cfschedule, cfset
Attributes
Usage
You can use this tag to make the following tests:
• To test whether a required variable exists, use this tag with only the name attribute. If it does
not exist, ColdFusion MX stops processing the page and returns an error.
• To test whether a required variable exists, and that it is of the specified type, use this tag with
the
name and type attributes. If the variable does not exist or its value is not of the specified
type, ColdFusion returns an error.
Attribute Req/Opt Default Description
name Required Name of parameter to test (such as "Client.Email " or
"Cookie.BackgroundColor "). If omitted, and if the parameter
does not exist, an error is thrown.
type Optional any The parameter data type:
• any: any type of value
• array: an array value
• binary: a binary value
• boolean: a Boolean value
• date: a date-time value
• guid: a Univerally Unique Identifier that follows the Microsoft/
DCE standard, as follows:
"
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" where ‘X’ is a
hexadecimal number.
• numeric: a numeric value
• query: a query object
• string: a string value or single character
• struct: a structure
• UUID: a ColdFusion Universally Unique Identifier, formatted
‘
XXXXXXXX-XXXX-XXXX-XXXXXXXXXXXXXXX’, where ‘X’ is a
hexadecimal number. See CreateUUID on page 438.
• variableName: a string formatted according to ColdFusion
variable naming conventions.
default Optional Value to set parameter to if it does not exist.