Tests for a parameter's existence, tests its data type, and, if
a default value is not assigned, optionally provides one.
<cfparam name="">
cfparam(name="", default="", pattern="");
Any
any
array
binary
boolean
creditcard
date
time
email
eurodate
float
numeric
guid
integer
query
range
regex
regular_expression
ssn
social_security_number
string
struct
telephone
url
uuid
usdate
variablename
xml
zipcode
A very basic CFML cfparam example
<cfparam name="userID" default="0"/>
Throws an error if the value is not one of a list of possible values
<cfparam name="sortdir" default="ASC" type="regex" pattern="ASC|DESC"/>
Three ways to use the param shorthand inside of a cfscript tag
param someVar; //declare the param
param someVar=5; //declare the param with a default value
param numeric someVar=3.1415; //declare the param with adefault value and set the type
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.