![]() ![]() ![]() |
The CFTEXTINPUT tag is a very close relative to the HTML INPUT=text tag. With CFTEXTINPUT, however, you can also specify font and alignment options, as well as enable one of two input validation methods using either a JavaScript or the VALIDATE attribute in CFTEXTINPUT.
The following example shows a basic CFTEXTINPUT control. This example validates a date entry, which means that a user must enter a valid date in the form mm/dd/yy.
<BR>Please enter a date: <CFFORM NAME="Form1" ACTION="cfform_submit.cfm" METHOD="Post"> <CFTEXTINPUT NAME="entertext" VALUE="mm/dd/yy" MAXLENGTH="10" VALIDATE="date" FONT="Trebuchet MS"> <BR><INPUT TYPE="Submit" VALUE="Submit"> </CFFORM>
The CFTEXTINPUT looks like this:
The value of the form variable passed from a CFTEXTINPUT control to a ColdFusion application page is determined by the entry in the CFTEXTINPUT control. The form variable is passed as:
textinput_name=textinput_value
In the example just above, the form variable would have been passed as:
entertext=textinput_value
So in the destination application page, the form variable is referenced as #entertext#.
You can validate user input for the CFTEXTINPUT control on the following data formats:
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. |
![]() ![]() ![]() |
AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.