The <input> element is used to create interactive controls for web-based forms in order to accept data from the user. How an input works varies considerably depending on the value of its type attribute.

Example:

Form { method = FormMethod.post;
    Label{ "User name", Input { id = "username"; type = InputType.text; }},
    Label{ "Password", Input { id = "password"; type = InputType.password; }},
    Input{ val = "Login"; type = InputType.submit; }
};
 <form method="post">
    <label>User name <input id="username" type="text"></label>
    <label>Password <input id="password" type="password"></label>
    <input value="Login" type="submit">
</form>

Technical details about this element can be found on the Official W3C reference.

no subtypes hierarchy

Initializer
Input(Attribute<String> id = null, Attribute<String> clazz = null, Attribute<String> accessKey = null, Attribute<Boolean> contentEditable = null, Attribute<String> contextMenu = null, Attribute<Direction> dir = null, Attribute<Boolean> draggable = null, Attribute<DropZone> dropZone = null, Attribute<Boolean> hidden = null, Attribute<String> lang = null, Attribute<Boolean> spellcheck = null, Attribute<String> style = null, Attribute<Integer> tabIndex = null, Attribute<String> title = null, Attribute<Boolean> translate = null, Attribute<InputType>|Attribute<String> type = null, Attribute<String> accept = null, Attribute<Boolean>|Attribute<String> autocomplete = null, Attribute<Boolean> autofocus = null, Attribute<Boolean> autosave = null, Attribute<Boolean> checked = null, Attribute<Boolean> disabled = null, Attribute<String> form = null, Attribute<String> formaction = null, Attribute<String>|Attribute<FormEnctype> formenctype = null, Attribute<String>|Attribute<FormMethod> formmethod = null, Attribute<Boolean> formnovalidate = null, Attribute<String>|Attribute<FormTarget> formtarget = null, Attribute<Integer> height = null, Attribute<InputMode>|Attribute<String> inputmode = null, Attribute<String> list = null, Attribute<String>|Attribute<Integer> max = null, Attribute<Integer> maxlength = null, Attribute<String>|Attribute<Integer> min = null, Attribute<Integer> minlength = null, Attribute<Boolean> multiple = null, Attribute<String> name = null, Attribute<String> pattern = null, Attribute<String> placeholder = null, Attribute<Boolean> readonly = null, Attribute<Boolean> required = null, Attribute<Integer> size = null, Attribute<String> src = null, Attribute<String>|Attribute<Integer> step = null, Attribute<String> val = null, Attribute<Integer> width = null, Attributes attributes = [])
Parameters:
  • id = null

    Attribute defines a unique identifier (ID) which must be unique in the whole document. Its purpose is to identify the element when linking (using a fragment identifier), scripting, or styling (with CSS).

  • clazz = null

    Attribute defines a space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors.

  • accessKey = null

    Attribute provides a hint for generating a keyboard shortcut for the current element. This attribute consists of a space-separated list of characters. The browser should use the first one that exists on the computer keyboard layout.

  • contentEditable = null

    Attribute indicates if the element should be editable by the user. If so, the browser modifies its widget to allow editing.

  • contextMenu = null

    Attribute defines id of an menu element to use as the contextual menu for this element

  • dir = null

    Attribute indicates the directionality of the element's text.

  • draggable = null

    Attribute indicates whether the element can be dragged.

  • dropZone = null

    Attribute indicates what types of content can be dropped on an element.

  • hidden = null

    Attribute indicates that the element is not yet, or is no longer, relevant. For example, it can be used to hide elements of the page that can't be used until the login process has been completed. The browser won't render such elements. This attribute must not be used to hide content that could legitimately be shown.

  • lang = null

    Attribute specifies the primary language for the element's contents and for any of the element's attributes that contain text. Its value must be a valid BCP 47 language tag, or the empty string. Setting the attribute to the empty string indicates that the primary language is unknown.

  • spellcheck = null

    Attribute defines whether the element may be checked for spelling errors.

  • style = null

    Attribute contains CSS styling declarations to be applied to the element. Note that it is recommended for styles to be defined in a separate file or files.

  • tabIndex = null

    Attribute indicates if the element can take input focus (is focusable), if it should participate to sequential keyboard navigation, and if so, at what position.

  • title = null

    Attribute contains a text representing advisory information related to the element it belongs to. Such information can typically, but not necessarily, be presented to the user as a tooltip.

  • translate = null

    Attribute that is used to specify whether an element's attribute values and the values of its text node children are to be translated when the page is localized, or whether to leave them unchanged.

  • type = null

    Attribute represents the type of the input.

  • accept = null

    If the value of the type attribute is file, this attribute indicates the types of files that the server accepts; otherwise it is ignored. The value must be a comma-separated list of unique content type specifiers.

  • autocomplete = null

    Attribute indicates whether the value of the control can be automatically completed by the browser.

  • autofocus = null

    Attribute lets you specify that the button should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form-associated element in a document can have this attribute specified.

  • autosave = null

    Attribute should be defined as a unique value. If the value of the type attribute is search, previous search term values will persist in the dropdown across page load.

  • checked = null

    Attribute indicates that the control is selected by default for radio or checkbox.

  • disabled = null

    Attribute indicates that the form control is not available for interaction.

  • form = null

    Attribute specifies the form element that the input is associated with (its form owner).

  • formaction = null

    Attribute specifies the URI of a program that processes the information submitted by the button. If specified, it overrides the action attribute of the button's form owner.

  • formenctype = null

    Attribute specifies the type of content that is used to submit the form to the server.

  • formmethod = null

    Attribute specifies the HTTP method that the browser uses to submit the form.

  • formnovalidate = null

    Attribute specifies that the form is not to be validated when it is submitted. If this attribute is specified, it overrides the novalidate attribute of the button's form owner.

  • formtarget = null

    Attribute is a name or keyword indicating where to display the response that is received after submitting the form. This is a name of, or keyword for, a browsing context (for example, tab, window, or inline frame).

  • height = null

    If the value of the type attribute is image, this attribute defines the height of the image displayed for the button.

  • inputmode = null

    A hint to the browser for which keyboard to display. This attribute applies when the value of the type attribute is text, password, email, or url.

  • list = null

    Identifies a list of pre-defined options to suggest to the user. The value must be the id of a datalist element in the same document. The browser displays only options that are valid values for this input element. This attribute is ignored when the type attribute's value is hidden, checkbox, radio, file, or a button type.

  • max = null

    The maximum (numeric or date-time) value for this item, which must not be less than its minimum value.

  • maxlength = null

    If the value of the type attribute is text, email, search, password, tel, or url, this attribute specifies the maximum number of characters that the user can enter, for other control types, it is ignored.

  • min = null

    The minimum (numeric or date-time) value for this item, which must not be greater than its maximum value.

  • minlength = null

    If the value of the type attribute is text, email, search, password, tel, or url, this attribute specifies the minimum number of characters that the user can enter, for other control types, it is ignored.

  • multiple = null

    Attribute indicates whether the user can enter more than one value. This attribute applies when the type attribute is set to email or file; otherwise it is ignored.

  • name = null

    Attribute represents the name of the button, which is submitted with the form data.

  • pattern = null

    A regular expression that the control's value is checked against. The pattern must match the entire value, not just some subset.

  • placeholder = null

    A hint to the user of what can be entered in the control. The placeholder text must not contain carriage returns or line-feeds. This attribute applies when the value of the type attribute is text, search, tel, url or email; otherwise it is ignored.

  • readonly = null

    Attribute indicates that the user cannot modify the value of the control. It is ignored if the value of the type attribute is hidden, range, color, checkbox, radio, file, or a button type.

  • required = null

    Attribute specifies that the user must fill in a value before submitting a form. It cannot be used when the type attribute is hidden, image, or a button type.

  • size = null

    The initial size of the control. This value is in pixels unless the value of the type attribute is text or password, in which case, it is an integer number of characters.

  • src = null

    If the value of the type attribute is image, this attribute specifies a URI for the location of an image to display on the graphical submit button; otherwise it is ignored.

  • step = null

    Works with the min and max attributes to limit the increments at which a numeric or date-time value can be set. It can be the string any or a positive floating point number. If this attribute is not set to any, the control accepts only values at multiples of the step value greater than the minimum.

  • val = null

    The initial value of the control. This attribute is optional except when the value of the type attribute is radio or checkbox.

  • width = null

    If the value of the type attribute is image, this attribute defines the width of the image displayed for the button.

  • attributes = []

    The attributes associated with this element.

Attributes
childrenSource Codeshared actual [] children

This element has no children.

Inherited Attributes
Attributes inherited from: Element
Attributes inherited from: Node
Attributes inherited from: Object
Inherited Methods
Methods inherited from: Object