Interface InputElement

All Superinterfaces:
Element, EventTarget, FormControlElement, Node, SearchContext

public interface InputElement extends FormControlElement
An HTML DOM input element.

Provides access to the attributes of the input element.

  • Method Details

    • isText

      boolean isText()
      Returns true when isTextField() returns true and the type attribute value of the input HTML element is 'number'.
      Throws:
      ObjectClosedException - when this instance is closed
    • isCheckbox

      boolean isCheckbox()
      Returns true if the DOM element's type attribute has the 'checkbox' value. When the return value is true, the checked state of the DOM element can be retrieved with the isChecked() method and changed with the check() or uncheck() methods.
      Throws:
      ObjectClosedException - when this instance is closed
    • isRadioButton

      boolean isRadioButton()
      Returns true if the DOM element's type attribute has the 'radio' value.
      Throws:
      ObjectClosedException - when this instance is closed
    • isTextField

      boolean isTextField()
      Returns true if the DOM element's type attribute has the 'text' value.
      Throws:
      ObjectClosedException - when this instance is closed
    • isEmailField

      boolean isEmailField()
      Returns true if the DOM element's type attribute has the 'email' value.
      Throws:
      ObjectClosedException - when this instance is closed
    • isPasswordField

      boolean isPasswordField()
      Returns true if the DOM element's type attribute has the 'password' value.
      Throws:
      ObjectClosedException - when this instance is closed
    • isFile

      boolean isFile()
      Returns true if the DOM element's type attribute has the 'file' value.
      Throws:
      ObjectClosedException - when this instance is closed
    • isMultipleFile

      boolean isMultipleFile()
      Returns true if the input DOM element has both the type attribute with the 'file' value, and the multiple attribute. For example: <input type="file" multiple>.
      Throws:
      ObjectClosedException - when this instance is closed
    • file

      String file()
      Returns a string that represents an absolute or relative path to a file if the current input DOM element has the type attribute with the 'file' value. If this DOM element has the multiple attribute, returns string that represents the first of file paths. Returns an empty string if the element does not have a file selected.
      Throws:
      IllegalStateException - when the type attribute value of the element is not 'file'
      ObjectClosedException - when this instance is closed
    • file

      void file(String... filePaths)
      Sets one or multiple string values that represent the path to a file. This method can be used only when the input DOM element with the type has the 'file' value.
      Parameters:
      filePaths - the list of strings that represent the paths to the files
      Throws:
      IllegalArgumentException - when one or more elements of the filePaths are empty or blank
      IllegalStateException - when the type attribute value of the element is not 'file'
      ObjectClosedException - when this instance is closed
    • files

      Collection<String> files()
      Returns an immutable collection of the file paths if the input type is 'file' or an empty collection if the input does not have a value.
      Throws:
      IllegalStateException - when the type attribute value of the element is not 'file'
      ObjectClosedException - when this instance is closed
    • isChecked

      boolean isChecked()
      Returns true if the input DOM element with the type 'checkbox' or 'radio' is selected. Use this method only with input elements with type 'checkbox' or 'radio'.
      Throws:
      IllegalStateException - when the type attribute value of the element is not 'checkbox' or 'radio'
      ObjectClosedException - when this instance is closed
    • check

      void check()
      Sets the checked attribute of the input DOM element with the type 'checkbox' or 'radio' to true.
      Throws:
      IllegalStateException - when the type attribute value of the element is not 'checkbox' or 'radio'
      ObjectClosedException - when this instance is closed
    • uncheck

      void uncheck()
      Sets the checked attribute of the input DOM element with the type 'checkbox' or 'radio' to false.
      Throws:
      IllegalStateException - when the type attribute value of the element is not 'checkbox' or 'radio'
      ObjectClosedException - when this instance is closed