<CFINPUT TYPE="input_type
" NAME="name" VALUE="initial_value" REQUIRED="Yes/No" RANGE="min_value, max_value
" VALIDATE="data_type" ONVALIDATE="javascript_function" MESSAGE="validation_msg" ONERROR="text" SIZE="integer
" MAXLENGTH="integer" CHECKED="Yes/No">
CFINPUT is used inside CFFORM to place radio buttons, checkboxes, or text boxes. Provides input validation for the specified control type.
You can add standard HTML FORM tag attributes and their values to the CFINPUT tag. These attributes and values are passed directly through Cold Fusion to the browser in creating a form. For example, FORM tag
attributes like TARGET can be used to enhance your CFFORM features.
CFINPUT supports the JavaScript onClick event in the same manner as the HTML INPUT tag:
<CFINPUT TYPE="radio" NAME="radio1" onClick="JavaScript_function
">
Attributes
TYPE |
Optional. Valid entries are:
- Text — Creates a text entry box control (default).
- Radio — Creates a radio button control.
- Checkbox — Creates a checkbox control.
- Password — Creates a password entry control.
|
NAME |
Required. A name for the form input element. |
VALUE |
Optional. An initial value for the form input element. |
REQUIRED |
Optional. Enter Yes or No. Default is No. |
RANGE |
Optional. Enter a minimum value, maximum value range separated by a comma. Valid only for numeric data. |
VALIDATE |
Optional. Valid entries are:
- 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.
|
ONVALIDATE |
Optional. The name of a valid JavaScript function used to validate user input. The form object, input object, and input object value are passed to the specified routine, which should return true if
validation succeeds and false otherwise. When used, the VALIDATE attribute is ignored. |
MESSAGE |
Optional. Message text to appear if validation fails. |
ONERROR |
Optional. The name of a valid JavaScript function you want to execute in the event of a failed validation. |
SIZE |
Optional. The size of the input control. Ignored if TYPE is Radio or Checkbox. |
MAXLENGTH |
Optional. The maximum length of text entered when TYPE is Text. |
CHECKED |
Optional. Places checkmark when TYPE is checkbox; preselects radio buttons when TYPE is Radio. |
Examples
<CFINPUT TYPE="text" NAME="BIRTH_DATE" VALUE="" REQUIRED="Yes" VALIDATE="date" MESSAGE="You must enter a birth date mm/dd/yyyy" SIZE="10" MAXLENGTH="10"> <CFINPUT TYPE="text" NAME="Credit_Card_Number" REQUIRED="Yes" VALIDATE="creditcard">
|