User Guide
68 Developing Web Applications with ColdFusion
example, if you want the error message to read "You must enter your first name," use
the syntax:
<INPUT TYPE="hidden"
NAME="FirstName_required"
VALUE="You must enter your first name.">
Validating the Data That Users Enter in Form Fields
Another limitation of HTML forms is that you cannot validate that users input the type
or range of data you expect. ColdFusion enables you to do several types of data
validation by adding hidden fields to forms. The hidden field suffixes you can use to do
validation are as follows:
Note Adding a validation rule to a field does not make it a required field. You
need to add a separate
_required hidden field if you want to ensure user
entry.
Form Field Validation Using Hidden Fields
Field Suffix Value Attribute Description
_integer
Custom error
message
Verifies that the user enters a number. If the
user enters a floating point value, it is
rounded to an integer.
_float
Custom error
message
Verifies that the user enters a number. Does
not do any rounding of floating point values.
_range
MIN=MinValue
MAX=MaxValue
Verifies that the numeric value entered is
within the specified boundaries. You can
specify one or both of the boundaries
separated by a space.
_date
Custom error
message
Verifies that a date has been entered and
converts the date into the proper ODBC date
format. Will accept most common date forms,
for example, 9/1/98; Sept. 9, 1998).
_time
Custom error
message
Verifies that a time has been correctly entered
and converts the time to the proper ODBC
time format.
_eurodate
Custom error
message
Verifies that a date has been entered in a
standard European date format and converts
into the proper ODBC date format.