Package org.jsoup.nodes

Class FormElement

All Implemented Interfaces:

public class FormElement extends Element
A HTML Form Element provides ready access to the form fields/controls that are associated with it. It also allows a form to easily be submitted.
  • Constructor Details

    • FormElement

      public FormElement(Tag tag, String baseUri, Attributes attributes)
      Create a new, standalone form element.
      tag - tag of this element
      baseUri - the base URI
      attributes - initial attributes
  • Method Details

    • elements

      public Elements elements()
      Get the list of form control elements associated with this form.
      form controls associated with this element.
    • addElement

      public FormElement addElement(Element element)
      Add a form control element to this form.
      element - form control to add
      this form element, for chaining
    • removeChild

      protected void removeChild(Node out)
      removeChild in class Node
    • submit

      public Connection submit()
      Prepare to submit this form. A Connection object is created with the request set up from the form values. This Connection will inherit the settings and the cookies (etc) of the connection/session used to request this Document (if any), as available in Document.connection()

      You can then set up other options (like user-agent, timeout, cookies), then execute it.

      a connection prepared from the values of this form, in the same session as the one used to request it
      IllegalArgumentException - if the form's absolute action URL cannot be determined. Make sure you pass the document's base URI when parsing.
    • formData

      public List<Connection.KeyVal> formData()
      Get the data that this form submits. The returned list is a copy of the data, and changes to the contents of the list will not be reflected in the DOM.
      a list of key vals
    • clone

      public FormElement clone()
      Description copied from class: Node
      Create a stand-alone, deep copy of this node, and all of its children. The cloned node will have no siblings or parent node. As a stand-alone object, any changes made to the clone or any of its children will not impact the original node.

      The cloned node may be adopted into another Document or node structure using Element.appendChild(Node).

      clone in class Element
      a stand-alone cloned node, including clones of any children
      See Also: