Dart API Referencedart:htmlInputElement

InputElement Interface

DOM Input objects expose the HTMLInputElement (or HTML 4 HTMLInputElement) interface, which provides special properties and methods (beyond the regular element object interface they also have available to them by inheritance) for manipulating the layout and presentation of input elements.

Extends

Element

Constructors

Code new InputElement([String type]) #

InputElement([String type]);

Methods

Code bool checkValidity() #

Returns false if the element is a candidate for constraint validation, and it does not satisfy its constraints. In this case, it also fires an invalid event at the element. It returns true if the element is not a candidate for constraint validation, or if it satisfies its constraints.
bool checkValidity();

Code InputElementEvents get on() #

InputElementEvents get on();

Code void select() #

Selects the input text in the element, and focuses it so the user can subsequently replace the whole entry.
void select();

Code void setCustomValidity(String error) #

Sets a custom validity message for the element. If this message is not the empty string, then the element is suffering from a custom validity error, and does not validate.
void setCustomValidity(String error);

Code void setSelectionRange(int start, int end, [String direction]) #

Selects a range of text in the element (but does not focus it). The optional selectionDirection parameter may be "forward" or "backward" to establish the direction in which selection was set, or "none"if the direction is unknown or not relevant. The default is "none". Specifying selectionDirection sets the value of the selectionDirection property.
void setSelectionRange(int start, int end, [String direction]);

Code void stepDown([int n]) #

Decrements the value by (step * n), where n defaults to 1 if not specified. Throws an INVALID_STATE_ERR exception:

  • if the method is not applicable to for the current type value.
  • if the element has no step value.
  • if the value cannot be converted to a number.
  • if the resulting value is above the max or below the min
void stepDown([int n]);

Code void stepUp([int n]) #

Increments the value by (step * n), where n defaults to 1 if not specified. Throws an INVALID_STATE_ERR exception:

  • if the method is not applicable to for the current type value.
  • if the element has no step value.
  • if the value cannot be converted to a number.
  • if the resulting value is above the max or below the min.
void stepUp([int n]);

Fields

Code String accept #

Reflects the accept HTML attribute, containing comma-separated list of file types accepted by the server when type is file.
String accept;

Code String align #

Alignment of the element. Obsolete in HTML5
String align;

Code String alt #

Reflects the alt  HTML attribute, containing alternative text to use when type is image.
String alt;

Code String autocomplete #

Reflects the {{htmlattrxref("autocomplete", "input)}} HTML attribute, indicating whether the value of the control can be automatically completed by the browser. Ignored if the value of the type attribute is hidden, checkbox, radio, file, or a button type (button, submit, reset, image). Possible values are:
  • off: The user must explicitly enter a value into this field for every use, or the document provides its own auto-completion method; the browser does not automatically complete the entry.
  • on: The browser can automatically complete the value based on values that the user has entered during previous uses.
String autocomplete;

Code bool autofocus #

Reflects the autofocus HTML attribute, which specifies that a form control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form element in a document can have the autofocus attribute. It cannot be applied if the type attribute is set to hidden (that is, you cannot automatically set focus to a hidden control).
bool autofocus;

Code bool checked #

The current state of the element when type is checkbox or radio.
bool checked;

Code bool defaultChecked #

The default state of a radio button or checkbox as originally specified in HTML that created this object.
bool defaultChecked;

Code String defaultValue #

The default value as originally specified in HTML that created this object.
String defaultValue;

Code bool disabled #

Reflects the disabled HTML attribute, indicating that the control is not available for interaction.
bool disabled;

Code FileList files #

A list of selected files.
FileList files;

Code final FormElement form #

The containing form element, if this element is in a form. If this element is not contained in a form element:

  • HTML5 this can be the id attribute of any <form> element in the same document. Even if the attribute is set on <input> , this property will be null, if it isn't the id of a <form> element.
  • HTML 4 this must be null.
final FormElement form;

Code String formAction #

Reflects the formaction HTML attribute, containing the URI of a program that processes information submitted by the element. If specified, this attribute overrides the action attribute of the <form> element that owns this element.
String formAction;

Code String formEnctype #

String formEnctype;

Code String formMethod #

Reflects the formmethod  HTML attribute, containing the HTTP method that the browser uses to submit the form. If specified, this attribute overrides the method attribute of the <form> element that owns this element.
String formMethod;

Code bool formNoValidate #

Reflects the formnovalidate  HTML attribute, indicating that the form is not to be validated when it is submitted. If specified, this attribute overrides the novalidate attribute of the <form> element that owns this element.
bool formNoValidate;

Code String formTarget #

Reflects the formtarget HTML attribute, containing a name or keyword indicating where to display the response that is received after submitting the form. If specified, this attribute overrides the target attribute of the <form> element that owns this element.
String formTarget;

Code int height #

Reflects the height HTML attribute, which defines the height of the image displayed for the button, if the value of type is image.
int height;

Code bool incremental #

bool incremental;

Code bool indeterminate #

Indicates that a checkbox is neither on nor off.
bool indeterminate;

Code final NodeList labels #

A list of <label> elements that are labels for this element.
final NodeList labels;

Code String max #

Reflects the max HTML attribute, containing the maximum (numeric or date-time) value for this item, which must not be less than its minimum (min attribute) value.
String max;

Code int maxLength #

Reflects the maxlength  HTML attribute, containing the maximum length of text (in Unicode code points) that the value can be changed to. The constraint is evaluated only when the value is changed

Note: If you set maxlength to a negative value programmatically, an exception will be thrown.
int maxLength;

Code String min #

Reflects the min HTML attribute, containing the minimum (numeric or date-time) value for this item, which must not be greater than its maximum (max attribute) value.
String min;

Code bool multiple #

Reflects the multiple HTML attribute, indicating whether more than one value is possible (e.g., multiple files).
bool multiple;

Code String name #

Reflects the name HTML attribute, containing a name that identifies the element when submitting the form.
String name;

Code String pattern #

Reflects the pattern HTML attribute, containing a regular expression that the control's value is checked against. The pattern must match the entire value, not just some subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is text, search, tel, url or email; otherwise it is ignored.
String pattern;

Code String placeholder #

Reflects the placeholder HTML attribute, containing 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.
String placeholder;

Code bool readOnly #

Reflects the readonly HTML attribute, indicating that the user cannot modify the value of the control.

HTML 5 This is ignored if the value of the type attribute is hidden, range, color, checkbox, radio, file, or a button type.

bool readOnly;

Code bool required #

Reflects the required HTML attribute, indicating that the user must fill in a value before submitting a form.
bool required;

Code String selectionDirection #

The direction in which selection occurred. This is "forward" if selection was performed in the start-to-end direction of the current locale, or "backward" for the opposite direction. This can also be "none" if the direction is unknown."
String selectionDirection;

Code int selectionEnd #

The index of the end of selected text.
int selectionEnd;

Code int selectionStart #

The index of the beginning of selected text.
int selectionStart;

Code int size #

Reflects the size HTML attribute, containing size of the control. This value is in pixels unless the value of type is text or password, in which case, it is an integer number of characters. HTML5 Applies only when type is set to text, search, tel, url, email, or password; otherwise it is ignored.
int size;

Code String src #

Reflects the src HTML attribute, which specifies a URI for the location of an image to display on the graphical submit button, if the value of type is image; otherwise it is ignored.
String src;

Code String step #

Reflects the step HTML attribute, which works with min and max 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 is not set to any, the control accepts only values at multiples of the step value greater than the minimum.
String step;

Code String type #

Reflects the type HTML attribute, indicating the type of control to display. See type attribute of <input> for possible values.
String type;

Code String useMap #

A client-side image map. Obsolete in HTML5
String useMap;

Code final String validationMessage #

A localized message that describes the validation constraints that the control does not satisfy (if any). This is the empty string if the control is not a candidate for constraint validation (willValidate is false), or it satisfies its constraints.
final String validationMessage;

Code final ValidityState validity #

The validity states that this element is in. 
final ValidityState validity;

Code String value #

Current value in the control.
String value;

Code Date valueAsDate #

The value of the element, interpreted as a date, or null if conversion is not possible.
Date valueAsDate;

Code num valueAsNumber #

The value of the element, interpreted as one of the following in order:

  1. a time value
  2. a number
  3. null if conversion is not possible
num valueAsNumber;

Code final EntryArray webkitEntries #

final EntryArray webkitEntries;

Code bool webkitGrammar #

bool webkitGrammar;

Code bool webkitSpeech #

bool webkitSpeech;

Code bool webkitdirectory #

bool webkitdirectory;

Code int width #

Reflects the width HTML attribute, which defines the width of the image displayed for the button, if the value of type is image.
int width;

Code final bool willValidate #

Indicates whether the element is a candidate for constraint validation. It is false if any conditions bar it from constraint validation.
final bool willValidate;

This page includes content from the Mozilla Foundation that is graciously licensed under a Creative Commons: Attribution-Sharealike license. Mozilla has no other association with Dart or dartlang.org. We encourage you to improve the web by contributing to The Mozilla Developer Network.