User Guide
248 Chapter 2: ColdFusion Tags
• onBlur In HTML format the form page on the browser includes JavaScript functions that
perform validation when the field loses the focus. In Flash format, the attribute is equivalent to
onSubmit. OnBlur validation uses the same algorithms as onSubmit validation. OnBlur
validation was added in ColdFusion MX 7.
• onServer ColdFusion performs the validation on the server. Some onServer algorithms vary
from the onSubmit algorithms. OnServer Date and Time validation allow more patterns than
onSubmit validation. OnServer validation was added in ColdFusion MX 7, and automatically
generates hidden fields to support the validation.
You can also omit a
validate attribute and specify the type of validation for the field in a
separate hidden form field. This form of validation is equivalent to onServer validation, but it
allows you to specify separate messages for each validation that you do on the field. It is backward
compatible with previous ColdFusion releases. For more information on hidden form field
validation, see
cfform and “Validating form data using hidden fields” in Chapter 28, “Validating
form data using hidden fields,” in ColdFusion MX Developer’s Guide.
validation types You can use the following values in the validate attribute to specify input
validation for all validation methods. Most attributes apply only to password or text fields. You
can specify multiple validation types in a comma-delimited list, but only some combinations are
meaningful.
Type Description
date If validateAt="onServer", allows any date format that returns True in the
IsDate function; otherwise, same as USdate.
USdate A US date of the format mm/dd/yy mm-dd-yy or mm.dd.yy, with 1-2 digit
days and months, 1-4 digit years.
eurodate A date of the format dd/mm/yy, with 1-2 digit days and months, 1-4 digit
years.. The format can use /, -, or . characters as delimiters.
time Time format hh:mm:ss
float or numeric A number; allows integers.
integer An integer.
range A numeric range.
boolean A value that can be converted to a Boolean value: Yes, No, True, False, or a
number.
telephone Standard U.S. telephone formats. Allows an initial 1 long-distance
designator and up to 5-digit extensions, optionally starting with x.
zipcode U.S. 5- or 9-digit ZIP code format #####-####. The separator can be a
hyphen (-) or a space.
creditcard Strips blanks and dashes; verifies number using mod10 algorithm. Number
must have 13-16 digits.
ssn or
social_security_number
US. Social Security number format, ###-##-####. The separator can be a
hyphen (-) or a space.