Class HTMLFormElement

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

public class HTMLFormElement extends HTMLElement implements org.htmlunit.corejs.javascript.Function
A JavaScript object HTMLFormElement.
See Also:
  • Constructor Details

    • HTMLFormElement

      public HTMLFormElement()
      Creates an instance.
  • Method Details

    • jsConstructor

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

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

      public void setName(String name)
      Sets the value of the property name.
      Overrides:
      setName in class HTMLElement
      Parameters:
      name - the new value
    • getElements

      public HTMLCollection getElements()
      Returns the value of the property elements.
      Returns:
      the value of this property
    • iterator

      public org.htmlunit.corejs.javascript.Scriptable iterator()
    • getLength

      public int getLength()
      Returns the value of the property length. Does not count input type=image elements (MSDN doc)
      Returns:
      the value of this property
    • getAction

      public String getAction()
      Returns the value of the property action.
      Returns:
      the value of this property
    • setAction

      public void setAction(String action)
      Sets the value of the property action.
      Parameters:
      action - the new value
    • getMethod

      public String getMethod()
      Returns the value of the property method.
      Returns:
      the value of this property
    • setMethod

      public void setMethod(String method)
      Sets the value of the property method.
      Parameters:
      method - the new property
    • getTarget

      public String getTarget()
      Returns the value of the property target.
      Returns:
      the value of this property
    • setTarget

      public void setTarget(String target)
      Sets the value of the property target.
      Parameters:
      target - the new value
    • getRel

      public String getRel()
      Returns the value of the rel property.
      Returns:
      the rel property
    • setRel

      public void setRel(String rel)
      Sets the rel property.
      Parameters:
      rel - rel attribute value
    • getRelList

      public DOMTokenList getRelList()
      Returns the relList attribute.
      Returns:
      the relList attribute
    • setRelList

      public void setRelList(Object rel)
      Sets the relList property.
      Parameters:
      rel - attribute value
    • getEnctype

      public String getEnctype()
      Returns the value of the property enctype.
      Returns:
      the value of this property
    • setEnctype

      public void setEnctype(String enctype)
      Sets the value of the property enctype.
      Parameters:
      enctype - the new value
    • getEncoding

      public String getEncoding()
      Returns the value of the property encoding.
      Returns:
      the value of this property
    • setEncoding

      public void setEncoding(String encoding)
      Sets the value of the property encoding.
      Parameters:
      encoding - the new value
    • getHtmlForm

      public HtmlForm getHtmlForm()
      Returns:
      the associated HtmlForm
    • submit

      public void submit()
      Submits the form (at the end of the current script execution).
    • requestSubmit

      public void requestSubmit(Object submitter)
      Submits the form by submitted using a specific submit button.
      Parameters:
      submitter - The submit button whose attributes describe the method by which the form is to be submitted. This may be either an <input> or <button> element whose type attribute is submit. If you omit the submitter parameter, the form element itself is used as the submitter.
    • reset

      public void reset()
      Resets this form.
    • getWithPreemption

      protected Object getWithPreemption(String name)
      Overridden to allow the retrieval of certain form elements by ID or name.
      Overrides:
      getWithPreemption in class HtmlUnitScriptable
      Parameters:
      name - the property name
      Returns:
      Scriptable.NOT_FOUND if not found
    • has

      public boolean has(String name, org.htmlunit.corejs.javascript.Scriptable start)
      Overridden to allow the retrieval of certain form elements by ID or name.
      Specified by:
      has in interface org.htmlunit.corejs.javascript.Scriptable
      Overrides:
      has in class org.htmlunit.corejs.javascript.ScriptableObject
      Parameters:
      name -
      start -
      Returns:
    • getOwnPropertyDescriptor

      protected org.htmlunit.corejs.javascript.ScriptableObject getOwnPropertyDescriptor(org.htmlunit.corejs.javascript.Context cx, Object id)
      Overridden to allow the retrieval of certain form elements by ID or name.
      Overrides:
      getOwnPropertyDescriptor in class org.htmlunit.corejs.javascript.ScriptableObject
      Parameters:
      cx -
      id -
      Returns:
    • findElements

      List<HtmlElement> findElements(String name)
    • findFirstElement

      private HtmlElement findFirstElement(String name)
    • isAccessibleByIdOrName

      private boolean isAccessibleByIdOrName(HtmlElement element, String name)
      Indicates if the element can be reached by id or name in expressions like "myForm.myField".
      Parameters:
      element - the element to test
      name - the name used to address the element
      Returns:
      true if this element matches the conditions
    • get

      public Object get(int index, org.htmlunit.corejs.javascript.Scriptable start)
      Returns the specified indexed property.
      Specified by:
      get in interface org.htmlunit.corejs.javascript.Scriptable
      Overrides:
      get in class org.htmlunit.corejs.javascript.ScriptableObject
      Parameters:
      index - the index of the property
      start - the scriptable object that was originally queried for this property
      Returns:
      the property
    • call

      public Object call(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args)
      Specified by:
      call in interface org.htmlunit.corejs.javascript.Callable
      Specified by:
      call in interface org.htmlunit.corejs.javascript.Function
    • construct

      public org.htmlunit.corejs.javascript.Scriptable construct(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, Object[] args)
      Specified by:
      construct in interface org.htmlunit.corejs.javascript.Constructable
      Specified by:
      construct in interface org.htmlunit.corejs.javascript.Function
    • dispatchEvent

      public boolean dispatchEvent(Event event)
      Description copied from class: EventTarget
      Dispatches an event into the event system (standards-conformant browsers only). See the Gecko DOM reference for more information.
      Overrides:
      dispatchEvent in class EventTarget
      Parameters:
      event - the event to be dispatched
      Returns:
      false if at least one of the event handlers which handled the event called preventDefault; true otherwise
    • checkValidity

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

      public boolean isNoValidate()
      Returns the value of the property novalidate.
      Returns:
      the value of this property
    • setNoValidate

      public void setNoValidate(boolean value)
      Sets the value of the property novalidate.
      Parameters:
      value - the new value