Class HTMLInputElement

All Implemented Interfaces:
Serializable, Cloneable, org.htmlunit.corejs.javascript.ConstProperties, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable

public class HTMLInputElement extends HTMLElement
The JavaScript object for HtmlInput.
See Also:
  • Field Details

    • labels_

      private NodeList labels_
      "Live" labels collection; has to be a member to have equality (==) working.
  • Constructor Details

    • HTMLInputElement

      public HTMLInputElement()
      Creates an instance.
  • Method Details

    • jsConstructor

      public void jsConstructor()
      JavaScript constructor.
      Overrides:
      jsConstructor in class HTMLElement
    • getType

      public String getType()
      Returns the type property.
      Returns:
      the type property
    • setType

      public void setType(String newType)
      Sets the value of the attribute type. Note: this replace the DOM node with a new one.
      Parameters:
      newType - the new type to set
    • setValue

      public void setValue(Object newValue)
      Sets the value of the JavaScript attribute value.
      Overrides:
      setValue in class HTMLElement
      Parameters:
      newValue - the new value
    • setChecked

      public void setChecked(boolean checked)
      Sets the checked property. Although this property is defined in Input it doesn't make any sense for input's other than checkbox and radio. This implementation does nothing. The implementations in Checkbox and Radio actually do the work.
      Parameters:
      checked - True if this input should have the checked attribute set
    • getDomNodeOrDie

      public HtmlInput getDomNodeOrDie()
      Returns the DOM node that corresponds to this JavaScript object or throw an exception if one cannot be found.
      Overrides:
      getDomNodeOrDie in class HTMLElement
      Returns:
      the DOM node
    • isChecked

      public boolean isChecked()
      Returns the value of the checked property. Although this property is defined in Input it doesn't make any sense for input's other than checkbox and radio. This implementation does nothing. The implementations in Checkbox and Radio actually do the work.
      Returns:
      the checked property
    • select

      public void select()
      Select this element.
    • getDefaultValue

      public String getDefaultValue()
      Returns the input's default value, used if the containing form gets reset.
      Returns:
      the input's default value, used if the containing form gets reset
      See Also:
    • setDefaultValue

      public void setDefaultValue(String defaultValue)
      Sets the input's default value, used if the containing form gets reset.
      Parameters:
      defaultValue - the input's default value, used if the containing form gets reset
      See Also:
    • isDefaultChecked

      public boolean isDefaultChecked()
      Returns the input's default checked value, used if the containing form gets reset.
      Returns:
      the input's default checked value, used if the containing form gets reset
      See Also:
    • setDefaultChecked

      public void setDefaultChecked(boolean defaultChecked)
      Sets the input's default checked value, used if the containing form gets reset.
      Parameters:
      defaultChecked - the input's default checked value, used if the containing form gets reset
      See Also:
    • getTextLength

      public int getTextLength()
      Gets the value of textLength attribute.
      Returns:
      the text length
    • getSelectionStart

      public Object getSelectionStart()
      Gets the value of selectionStart attribute.
      Returns:
      the selection start
    • setSelectionStart

      public void setSelectionStart(int start)
      Sets the value of selectionStart attribute.
      Parameters:
      start - selection start
    • getSelectionEnd

      public Object getSelectionEnd()
      Gets the value of selectionEnd attribute.
      Returns:
      the selection end
    • setSelectionEnd

      public void setSelectionEnd(int end)
      Sets the value of selectionEnd attribute.
      Parameters:
      end - selection end
    • getMaxLength

      public int getMaxLength()
      Gets the max length.
      Returns:
      the max length
    • setMaxLength

      public void setMaxLength(int length)
      Sets the value of maxLength attribute.
      Parameters:
      length - the new value
    • getMinLength

      public int getMinLength()
      Gets the minLength.
      Returns:
      the minLength
    • setMinLength

      public void setMinLength(int length)
      Sets the value of minLength attribute.
      Parameters:
      length - the new value
    • getMin

      public String getMin()
      Gets the min property.
      Returns:
      the min property
    • setMin

      public void setMin(String min)
      Sets the min property.
      Parameters:
      min - the min property
    • getMax

      public String getMax()
      Gets the max property.
      Returns:
      the max property
    • setMax

      public void setMax(String max)
      Sets the max property.
      Parameters:
      max - the max property
    • getStep

      public String getStep()
      Gets the step property.
      Returns:
      the step property
    • setStep

      public void setStep(String step)
      Sets the step property.
      Parameters:
      step - the step property
    • isReadOnly

      public boolean isReadOnly()
      Gets the value of readOnly attribute.
      Returns:
      the readOnly attribute
    • setReadOnly

      public void setReadOnly(boolean readOnly)
      Sets the value of readOnly attribute.
      Parameters:
      readOnly - the new value
    • setSelectionRange

      public void setSelectionRange(int start, int end)
      Sets the selected portion of this input element.
      Parameters:
      start - the index of the first character to select
      end - the index of the character after the selection
    • getAlt

      public String getAlt()
      Returns the value of the alt property.
      Returns:
      the value of the alt property
    • setAlt

      public void setAlt(String alt)
      Returns the value of the alt property.
      Parameters:
      alt - the value
    • getAlign

      public String getAlign()
      Returns the value of the align property.
      Returns:
      the value of the align property
    • setAlign

      public void setAlign(String align)
      Sets the value of the align property.
      Parameters:
      align - the value of the align property
    • getSrc

      public String getSrc()
      Returns the value of the src attribute.
      Returns:
      the value of the src attribute
    • setSrc

      public void setSrc(String src)
      Sets the value of the src attribute.
      Parameters:
      src - the new value
    • getValue

      public String getValue()
      Returns the value of the JavaScript attribute value.
      Overrides:
      getValue in class HTMLElement
      Returns:
      the value of this attribute
    • getAttribute

      public String getAttribute(String attributeName)
      Overrides:
      getAttribute in class Element
      Parameters:
      attributeName - attribute name
      Returns:
      the value of the specified attribute, null if the attribute is not defined
    • click

      public void click() throws IOException
      Click this element. This simulates the action of the user clicking with the mouse.
      Overrides:
      click in class HTMLElement
      Throws:
      IOException - if this click triggers a page load that encounters problems
    • isEndTagForbidden

      protected boolean isEndTagForbidden()
      Returns whether the end tag is forbidden or not.
      Overrides:
      isEndTagForbidden in class HTMLElement
      Returns:
      whether the end tag is forbidden or not
      See Also:
    • isRequired

      public boolean isRequired()
      Returns the required property.
      Returns:
      the required property
    • setRequired

      public void setRequired(boolean required)
      Sets the required property.
      Parameters:
      required - the new value
    • getSize

      public String getSize()
      Returns the size attribute.
      Returns:
      the size attribute
    • setSize

      public void setSize(String size)
      Sets the size attribute.
      Parameters:
      size - the new size value
    • getAccept

      public String getAccept()
      Returns the accept attribute.
      Returns:
      the accept attribute
    • setAccept

      public void setAccept(String accept)
      Sets the accept attribute.
      Parameters:
      accept - the new accept value
    • getAutocomplete

      public String getAutocomplete()
      Returns the autocomplete attribute.
      Returns:
      the autocomplete attribute
    • setAutocomplete

      public void setAutocomplete(String autocomplete)
      Sets the autocomplete attribute.
      Parameters:
      autocomplete - the new autocomplete value
    • getFiles

      public Object getFiles()
      Returns the files property.
      Returns:
      the files property
    • getPlaceholder

      public String getPlaceholder()
      Returns the placeholder attribute.
      Returns:
      the placeholder attribute
    • setPlaceholder

      public void setPlaceholder(String placeholder)
      Sets the placeholder attribute.
      Parameters:
      placeholder - the new placeholder value
    • getWidth

      public int getWidth()
      Returns the width property.
      Returns:
      the width property
    • setWidth

      public void setWidth(int width)
      Sets the width property.
      Parameters:
      width - the width property
    • getHeight

      public int getHeight()
      Returns the height property.
      Returns:
      the height property
    • setHeight

      public void setHeight(int height)
      Sets the height property.
      Parameters:
      height - the height property
    • getLabels

      public NodeList getLabels()
      Returns the labels associated with the element.
      Returns:
      the labels associated with the element
    • checkValidity

      public boolean checkValidity()
      Checks whether the element has any constraints and whether it satisfies them.
      Returns:
      if the element is valid
    • getName

      public String getName()
      Returns the value of the JavaScript attribute name.
      Overrides:
      getName in class HTMLElement
      Returns:
      the value of this attribute
    • setName

      public void setName(String newName)
      Sets the value of the JavaScript attribute name.
      Overrides:
      setName in class HTMLElement
      Parameters:
      newName - the new name
    • isDisabled

      public boolean isDisabled()
      Returns true if this element is disabled. Overridden to modify browser configurations.
      Overrides:
      isDisabled in class HTMLElement
      Returns:
      true if this element is disabled
    • setDisabled

      public void setDisabled(boolean disabled)
      Sets whether or not to disable this element. Overridden to modify browser configurations.
      Overrides:
      setDisabled in class HTMLElement
      Parameters:
      disabled - True if this is to be disabled
    • getForm

      public HTMLFormElement getForm()
      Returns the value of the JavaScript form attribute.
      Overrides:
      getForm in class HTMLElement
      Returns:
      the value of the JavaScript form attribute
    • getValidity

      public ValidityState getValidity()
      Returns:
      a ValidityState with the validity states that this element is in.
    • getWillValidate

      public boolean getWillValidate()
      Returns:
      whether the element is a candidate for constraint validation
    • setCustomValidity

      public void setCustomValidity(String message)
      Sets the custom validity message for the element to the specified message.
      Parameters:
      message - the new message
    • isFormNoValidate

      public boolean isFormNoValidate()
      Returns the value of the property formnovalidate.
      Returns:
      the value of this property
    • setFormNoValidate

      public void setFormNoValidate(boolean value)
      Sets the value of the property formnovalidate.
      Parameters:
      value - the new value