<CFPARAM NAME="param_name"
DEFAULT="value">
CFPARAM is used to test for a parameter's existence and optionally provide a default if it is not found.
NAME
The name of the parameter you are testing (such as "Client.Email" or "Cookie.BackgroundColor"). If you omit the DEFAULT attribute, an error occurs if the specified parameter does not exist.
DEFAULT
Optional. Default value to set the parameter to if it does not exist.
Usage
There are two ways to use CFPARAM:
- Test for a required variable -- Use CFPARAM with only the NAME attribute to test that a required variable exists. If the variable does not exist, ColdFusion server stops processing the page and returns an error.
- Test for an optional variable -- Use CFPARAM with both the NAME and DEFAULT attributes to test for the existence of an optional variable. If the variable exists, processing 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.