The CFINPUT and CFTEXTINPUT tags include the VALIDATE attributes which allows you to specify a valid data type entry for the control. You can validate user entries on the following data types.
Input Validation Controls | |
---|---|
VALIDATE Entry | Description |
Date | Verifies US date entry in the form mm/dd/yyy. |
Eurodate | Verifies valid European date entry in the form dd/mm/yyyy. |
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. Telephone data must be entered as ###-###-####. The hyphen separator (-) can be replaced 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 5-digit or 9-digit zip in the form #####-####. The hyphen separator (-) can be replaced with a blank. |
Creditcard | Blanks and dashes are stripped and the number is verified using the mod10 algorithm. |
Social_security_number | Number must be entered as ###-##-####. The hyphen separator (-) can be replaced with a blank. |
When you specify an input type in the VALIDATE attribute, ColdFusion tests for the specified input type when the form is submitted and submits form data only on a successful match. A true value is returned on successful form submission, false if validation fails.