Contents

cfparam

Description

Tests for a parameter's existence, tests its data type, and provides a default value if one is not assigned.

Category

Other

Implemented

Usage Syntax

<cfparam  
	name="String"
	[type="String"]
	[default="Any"]
	[min="number"]
	[max="number"]
	[pattern="String"]
 />

[] = Optional attribute

Attributes

Name Type Required Default Description
name String Yes The name of the parameter to test, such as Client.Email or Cookie.BackgroundColor. If you omit the DEFAULT attribute, an error occurs if the specified parameter does not exist
type String No The type of parameter that is required. The default is 'any'.
default Any No Default value to set the parameter to if it does not exist.
min number No define the smallest size of a numeric value, used for type range
max number No define the biggest size of a numeric value, used for type range
pattern String No define a regular expression pattern, to check value against

Example Usage