View comments | RSS feed
Contents > Developing ColdFusion MX Applications > Building Dynamic Forms > Input validation with cfform controls PreviousNext

Input validation with cfform controls

The cfinput and cftextinput tags include the validate attributes, which lets you specify a valid data entry type for the control. You can validate user entries on the following data types:

Data type

Description

Date

Verifies US date entry in the form mm/dd/yyyy (where the year can have one through four digits).

Eurodate

Verifies valid European date entry in the form dd/mm/yyyy (where the year can have one through four digits).

Time

Verifies a time entry in the form hh:mm:ss.

Float

Verifies a floating point entry.

Integer

Verifies an integer entry.

Telephone

Verifies a telephone entry. You must enter telephone data as ###-###-####. You can replace the hyphen separator (-) with a blank. The area code and exchange must begin with a digit between 1 and 9.

Zipcode

(U.S. formats only) Number can be a five-digit or nine-digit zip in the form #####-####. You can replace the hyphen separator (-) with a blank.

Creditcard

Blanks and dashes are stripped and the number is verified using the mod10 algorithm.

Social_security_number

You must enter the number as ###-##-####. You can replace the hyphen separator (-) with a blank.

Regular_expression

Matches the input against a JavaScript regular expression pattern. You must use the pattern attribute to specify the regular expression. Any entry containing characters that matches the pattern is valid.

When you specify an input type in the validate attribute, ColdFusion tests for the specified input type when you submit the form, and submits form data only on a successful match. A successful form submission returns the value True and returns the value False if validation fails.


Contents > Developing ColdFusion MX Applications > Building Dynamic Forms > Input validation with cfform controls PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


Henweigh99 said on Apr 15, 2004 at 12:30 PM :
It would be nice to include a way to bypass the validation in the event that the form field is in "disabled" mode.
halL said on Apr 16, 2004 at 9:01 AM :
This is a known issue and there is a bug report (37030) outstanding against this behavior.
godardk said on May 5, 2004 at 12:54 PM :
when using regular expression pattern validation and setting required="No", coldfusion fails to make the input field optional.
For example, the code below will require a user to enter a valid email address, even though the field should not be required.

<cfinput type="Text"
name="cc"
message="Valid email address required in CC field."
validate="Regular_expression"
required="No"
size="85"
maxlength="85"
pattern="^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$">
ASandstrom said on May 6, 2004 at 8:30 AM :
This issue has been entered as bug report 55383.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/dynami37.htm