<cfinput>
Used inside <cfform> to place radio buttons, checkboxes, or text boxes.
Provides input validation for the specified control type.
This tag cannot have a body.
This tag is also supported within <cfscript>
Requires Extension: Form Tags for Jakarta EE (Lucee 7+)
<cfinput
autosuggest=string
autosuggestBindDelay=number
autosuggestMinLength=number
delimiter=string
maxResultsDisplayed=number
onBindError=string
showAutosuggestLoadingIcon=boolean
sourceForTooltip=string
typeahead=boolean
validateAt=string
type=string
name=string
value=string
required=boolean
range=string
validate=string
bind=string
bindAttribute=string
bindOnLoad=boolean
border=string
accept=string
accesskey=string
align=string
alt=string
checked=string
daynames=string
firstDayOfWeek=number
monthNames=string
height=string
width=string
hspace=string
label=string
mask=string
notab=string
datafld=string
datasrc=string
dataformatas=string
disabled=string
ismap=string
readonly=string
src=string
usemap=string
title=string
dir=string
lang=string
onValidate=string
pattern=string
message=string
onError=string
size=string
maxLength=number
passThrough=any
class=string
id=string
onBlur=string
onChange=string
onClick=string
onDblclick=string
onFocus=string
onKeyDown=string
onKeyPress=string
onKeyUp=string
onMouseDown=string
onMouseMove=string
onselect=string
onMouseUp=string
onMouseOut=string
onMouseOver=string
style=string
tabIndex=string
enabled=string
visible=string
tooltip=string
autocomplete=string
autofocus=string
form=string
formaction=string
formenctype=string
formmethod=string
formnovalidate=string
formtarget=string
list=string
max=string
min=string
multiple=string
placeholder=string
step=string
>
| Attribute | Description |
|---|---|
autosuggest
string, optional
|
edit
Specifies entry completion suggestions to display as the user types into a text input. The user can select a suggestion to complete the text entry. The valid value can be either of the following:
|
autosuggestBindDelay
number, optional
|
edit
The minimum time between autosuggest bind expression invocations, in seconds. Use this attribute to limit the number of requests that are sent to the server when a user types. Valid only for cfinput type="text" |
autosuggestMinLength
number, optional
|
edit
The minimum number of characters required in the text box before invoking a bind expression to return items for suggestion. Valid only for cfinput type="text". |
delimiter
string, optional
|
edit
The delimiter to use to separate entries in a static autosuggest list. This attribute is meaningful only if the autosuggest attribute is a string of delimited values. |
maxResultsDisplayed
number, optional
|
edit
The maximum number suggestions to display in the autosuggest list. Valid only for cfinput type="text". |
onBindError
string, optional
|
edit
The name of a JavaScript function to execute if evaluating a bind expression, including an autosuggest bind expression, results in an error. The function must take two attributes: an HTTP status code and a message. |
showAutosuggestLoadingIcon
boolean, optional
|
edit
A Boolean value that specifies whether to display an animated icon when loading an autosuggest value for a text input. |
sourceForTooltip
string, optional
|
edit
The URL of a page to display as a tool tip. The page can include HTML markup to control the format, and the tip can include images. If you specify this attribute, an animated icon appears with the text "Loading..." while the tip is being loaded. |
typeahead
boolean, optional
|
edit
A Boolean value that specifies whether the autosuggest feature should automatically complete a user's entry with the first result in the suggestion list. Valid only for cfinput type="text". |
validateAt
string, optional
|
edit
How to do the validation; one or more of the following: onSubmit, onServer or onBlur. onBlur and onSubmit are identical in Flash forms. For multiple values, use a comma-delimited list. Default: onSubmit |
type
string, optional
|
edit
The input control type to create:
|
name
string, required
|
edit
A name for the form input element. |
value
string, optional
|
edit
An initial value for the form input element. |
required
boolean, optional
|
edit
Enter Yes or No. Default is No. |
range
string, optional
|
edit
Enter a minimum and maximum value range, separated by a comma. Valid only for numeric data. |
validate
string, optional
|
edit
|
bind
string, optional
|
edit
(not supported) A Flash bind expression that populates the field with information from other form fields. |
bindAttribute
string, optional
|
edit
Specifies the HTML tag attribute whose value is set by the bind attribute. You can only specify attributes in the browser's HTML DOM tree, not Lucee-specific attributes. Ignored if there is no bind attribute. Valid only for cfinput type="text". |
bindOnLoad
boolean, optional
|
edit
A Boolean value that specifies whether to execute the bind attribute expression when first loading the form. Ignored if there is no bind attribute. Valid only for cfinput type="text". |
border
string, optional
|
edit
passed through to input tag created, only used for type html. |
accept
string, optional
|
edit
passed through to input tag created, only used for type html. |
accesskey
string, optional
|
edit
passed through to input tag created, only used for type html. |
align
string, optional
|
edit
passed through to input tag created, only used for type html. |
alt
string, optional
|
edit
passed through to input tag created, only used for type html. |
checked
string, optional
|
edit
Selects a control. No value is required. Applies if type=radio or checkbox. Default: false |
daynames
string, optional
|
edit
A comma-delimited list that sets the names of the weekdays displayed in the calendar. Sunday is the first day and the rest of the weekday names follow in the normal order. Default is: S,M,T,W,Th,F,S |
firstDayOfWeek
number, optional
|
edit
Integer in the range 0-6 specifying the first day of the week in the calendar, 0 indicates Sunday, 6 indicates Saturday. Default is: 0 |
monthNames
string, optional
|
edit
A comma-delimited list of the month names that are displayed at the top of the calendar. |
height
string, optional
|
edit
Applies to most Flash types, HTML image type on some browsers. The height of the control, in pixels. The displayed height might be less than the specified size. |
width
string, optional
|
edit
Applies to most Flash types, HTML image type on some browsers. The width of the control, in pixels. For Flash forms, Lucee ignores this attribute if you also specify a size attribute value. |
hspace
string, optional
|
edit
passed through to form tag created, only used for type html. |
label
string, optional
|
edit
Label to put next to the control on a Flash or XML form. Not used for button, hidden, image, reset, or submit types. |
mask
string, optional
|
edit
A mask pattern that controls the character pattern that users can enter, or that the form sends to Lucee. In HTML and Flash for type=text use:
In Flash for type=datefield use:
|
notab
string, optional
|
edit
passed through to form tag created, only used for type html. |
datafld
string, optional
|
edit
passed through to form tag created, only used for type html. |
datasrc
string, optional
|
edit
passed through to form tag created, only used for type html. |
dataformatas
string, optional
|
edit
passed through to form tag created, only used for type html. |
disabled
string, optional
|
edit
Disables user input, making the control read-only. To disable input, specify disabled without an attribute or disabled="true". To enable input, omit the attribute or specify disabled="false". |
ismap
string, optional
|
edit
passed through to form tag created, only used for type html. |
readonly
string, optional
|
edit
passed through to form tag created, only used for type html. |
src
string, optional
|
edit
Applies to Flash button, reset, submit, and image types, and the HTML image type. URL of an image to use on the button. Flash does not support GIF images. |
usemap
string, optional
|
edit
passed through to form tag created, only used for type html. |
title
string, optional
|
edit
passed through to form tag created, only used for type html. |
dir
string, optional
|
edit
passed through to form tag created, only used for type html. |
lang
string, optional
|
edit
passed through to form tag created, only used for type html. |
onValidate
string, optional
|
edit
The name of a 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. If used, the validate attribute is ignored. |
pattern
string, optional
|
edit
The JavaScript regular expression pattern to use to validate the input. Required only if you specify validate = "regular_expression". |
message
string, optional
|
edit
Message text to appear if validation fails. |
onError
string, optional
|
edit
The name of a JavaScript function you want to execute in the event of a failed validation. |
size
string, optional
|
edit
The size of the input control. Ignored if type is Radio or Checkbox. |
maxLength
number, optional
|
edit
The maximum length of text entered, if n type is Text. |
passThrough
any, optional
|
edit
HTML attributes that are not explicitly supported by cfinput. If you specify an attribute and value, they are passed to the HTML code generated for the cfinput tag. |
class
string, optional
|
edit
passed through to form tag created, only used for type html. |
id
string, optional
|
edit
passed through to form tag created, only used for type html. |
onBlur
string, optional
|
edit
passed through to form tag created, only used for type html. |
onChange
string, optional
|
edit
passed through to form tag created, only used for type html. |
onClick
string, optional
|
edit
passed through to form tag created, only used for type html. |
onDblclick
string, optional
|
edit
passed through to form tag created, only used for type html. |
onFocus
string, optional
|
edit
passed through to form tag created, only used for type html. |
onKeyDown
string, optional
|
edit
passed through to form tag created, only used for type html. |
onKeyPress
string, optional
|
edit
passed through to form tag created, only used for type html. |
onKeyUp
string, optional
|
edit
passed through to form tag created, only used for type html. |
onMouseDown
string, optional
|
edit
passed through to form tag created, only used for type html. |
onMouseMove
string, optional
|
edit
passed through to form tag created, only used for type html. |
onselect
string, optional
|
edit
passed through to form tag created, only used for type html. |
onMouseUp
string, optional
|
edit
passed through to form tag created, only used for type html. |
onMouseOut
string, optional
|
edit
passed through to form tag created, only used for type html. |
onMouseOver
string, optional
|
edit
passed through to form tag created, only used for type html. |
style
string, optional
|
edit
passed through to form tag created, only used for type html. |
tabIndex
string, optional
|
edit
passed through to form tag created, only used for type html. |
autocomplete
string, optional
|
edit
HTML attribute: Specifies the types of files that can be submitted through a file upload (only for type="file") |
autofocus
string, optional
|
edit
Specifies that the input field should have focus on page load (not for type="hidden") |
form
string, optional
|
edit
HTML attribute: Specifies one or more forms the input field belongs to |
formaction
string, optional
|
edit
HTML attribute: Overrides the form's action attribute. Must be a valid URL that defines where to send the data when the form is submitted (for type="submit" and type="image") |
formenctype
string, optional
|
edit
HTML attribute: Overrides the form's enctype attribute. Specifies how form-data should be encoded before sending it to the server (for type="submit" and type="image") |
formmethod
string, optional
|
edit
HTML attribute: Overrides the form's method attribute. Defines the HTTP method for sending data to the action URL (for type="submit" and type="image") |
formnovalidate
string, optional
|
edit
HTML attribute: Overrides the form's novalidate attribute. If present the input field should not be validated when submitted |
formtarget
string, optional
|
edit
HTML attribute: Overrides the form's target attribute. Specifies the target window used when the form is submitted (for type="submit" and type="image") |
list
string, optional
|
edit
HTML attribute: Refers to a datalist containing predefined options for the input field |
max
string, optional
|
edit
HTML attribute: Specifies the input field's maximum value. Use together with the "min" attribute to create a range of legal values |
min
string, optional
|
edit
HTML attribute: Specifies the input field's minimum value. Use together with the "max" attribute to create a range of legal values |
multiple
string, optional
|
edit
HTML attribute: If present the user is allowed more than one value |
placeholder
string, optional
|
edit
HTML attribute: Specifies a hint to help users fill out the input field |
step
string, optional
|
edit
HTML attribute: Specifies the legal number intervals for the input field |
Unimplemented Attribute(s)
| Attribute | Description |
|---|---|
enabled
string,
optional
|
edit
Flash only: Boolean value specifying whether the control is enabled. A disabled control appears in light gray. The inverse of the disabled attribute. Flash only. Default: true * unimplemented * |
visible
string,
optional
|
edit
Flash only: Boolean value specifying whether to show the control. Space that would be occupied by an invisible control is blank. Default: true * unimplemented * |
tooltip
string,
optional
|
edit
Flash only: Text to display when the mouse pointer hovers over the control. * unimplemented * |
Examples
edit<cfform name="sampleForm">
<label>FirstName:</label>
<cfinput type ="Text" name ="firstname"
message ="Enter firstname"
required ="yes">
<br/><br/>
<label>Password:</label>
<cfinput type ="password" name ="password"
message ="Enter password"
required ="yes">
</cfform>
See also
- Ajax features
- <cfform>
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)