Using The Cfparam Tag To Validate The Data Type - MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual

Developing coldfusion mx applications
Table of Contents

Advertisement

Use the
cfqueryparam
information on this technique, see
Note: Data validation using the cfparam, cfqueryparam, and form tags is done by the server.
Validation using cfform tags is done using JavaScript in the user's browser, before any data is sent
to the server.

Using the cfparam tag to validate the data type

The
cfparam type
parameter type must be any of the following values:
Type value
any
array
binary
boolean
date
numeric
query
string
struct
UUID
variableName
For example, you can use the following code to validate the variable BirthDate:
<cfparam name="BirthDate" type="date">
If the variable is not in a valid date format, an error occurs and the page stops processing.
tag in a SQL WHERE clause to validate query parameters. For
Chapter 20, "Using cfqueryparam," on page
attribute lets you validate the type of a parameter. You can specify that the
Meaning
Any value
Any array value
Any binary value
True, False, Yes, or No
Any value in a valid date, time, or date-time format
Any number
A query object
A text string or single character
A structure
A Universally Unique Identifier (UUID) formatted as XXXXXXXX-XXXX-XXXX-
XXXXXXXXXXXXXXX where X stands for a hexadecimal digit (0-9 or A-F).
A valid variable name
435.
Validating data types
81

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents