Class HTMLFormElement

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.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:
    MSDN documentation, Serialized Form
    • Constructor Detail

      • HTMLFormElement

        public HTMLFormElement()
        Creates an instance.
    • Method Detail

      • getName

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

        public void setName​(java.lang.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 java.lang.String getAction()
        Returns the value of the property action.
        Returns:
        the value of this property
      • setAction

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

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

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

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

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

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

        public void setRel​(java.lang.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​(java.lang.Object rel)
        Sets the relList property.
        Parameters:
        rel - attribute value
      • getEnctype

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

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

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

        public void setEncoding​(java.lang.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​(java.lang.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 java.lang.Object getWithPreemption​(java.lang.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​(java.lang.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,
                                                                                           java.lang.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

        java.util.List<HtmlElement> findElements​(java.lang.String name)
      • findFirstElement

        private HtmlElement findFirstElement​(java.lang.String name)
      • isAccessibleByIdOrName

        private boolean isAccessibleByIdOrName​(HtmlElement element,
                                               java.lang.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 java.lang.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 java.lang.Object call​(org.htmlunit.corejs.javascript.Context cx,
                                     org.htmlunit.corejs.javascript.Scriptable scope,
                                     org.htmlunit.corejs.javascript.Scriptable thisObj,
                                     java.lang.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,
                                                                   java.lang.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