Package org.jsoup.nodes
Class FormElement
java.lang.Object
org.jsoup.nodes.Node
org.jsoup.nodes.Element
org.jsoup.nodes.FormElement
- All Implemented Interfaces:
-
Cloneable
An 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 Summary
ConstructorDescriptionFormElement
(Tag tag, @Nullable String baseUri, @Nullable Attributes attributes) Create a new, standalone form element. -
Method Summary
Modifier and TypeMethodDescriptionaddElement
(Element element) Add a form control element to this form.clone()
Create a stand-alone, deep copy of this node, and all of its children.elements()
Get the list of form control elements associated with this form.List
<Connection.KeyVal> formData()
Get the data that this form submits.protected void
removeChild
(Node out) submit()
Prepare to submit this form.Methods inherited from class org.jsoup.nodes.Element
addClass, after, after, append, appendChild, appendChildren, appendElement, appendElement, appendText, appendTo, attr, attr, attribute, attributes, baseUri, before, before, child, childNodeSize, children, childrenSize, className, classNames, classNames, clearAttributes, closest, closest, cssSelector, data, dataNodes, dataset, doClone, doSetBaseUri, elementIs, elementSiblingIndex, empty, endSourceRange, ensureChildNodes, expectFirst, filter, firstElementChild, firstElementSibling, forEach, forEachNode, getAllElements, getElementById, getElementsByAttribute, getElementsByAttributeStarting, getElementsByAttributeValue, getElementsByAttributeValueContaining, getElementsByAttributeValueEnding, getElementsByAttributeValueMatching, getElementsByAttributeValueMatching, getElementsByAttributeValueNot, getElementsByAttributeValueStarting, getElementsByClass, getElementsByIndexEquals, getElementsByIndexGreaterThan, getElementsByIndexLessThan, getElementsByTag, getElementsContainingOwnText, getElementsContainingText, getElementsMatchingOwnText, getElementsMatchingOwnText, getElementsMatchingText, getElementsMatchingText, hasAttributes, hasChildNodes, hasClass, hasText, html, html, html, id, id, insertChildren, insertChildren, is, is, isBlock, lastElementChild, lastElementSibling, nextElementSibling, nextElementSiblings, nodeName, normalName, ownText, parent, parents, prepend, prependChild, prependChildren, prependElement, prependElement, prependText, previousElementSibling, previousElementSiblings, removeAttr, removeClass, root, select, select, selectFirst, selectFirst, selectXpath, selectXpath, shallowClone, siblingElements, stream, tag, tagName, tagName, tagName, text, text, textNodes, toggleClass, traverse, val, val, wholeOwnText, wholeText, wrap
Methods inherited from class org.jsoup.nodes.Node
absUrl, addChildren, addChildren, attr, attributesSize, childNode, childNodes, childNodesAsArray, childNodesCopy, equals, firstChild, hasAttr, hashCode, hasParent, hasSameValue, indent, lastChild, nameIs, nextSibling, nodeStream, nodeStream, outerHtml, outerHtml, ownerDocument, parentElementIs, parentNameIs, parentNode, previousSibling, remove, reparentChild, replaceChild, replaceWith, setBaseUri, setParentNode, setSiblingIndex, siblingIndex, siblingNodes, sourceRange, toString, unwrap
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
Method Details
-
elements
Get the list of form control elements associated with this form.- Returns:
- form controls associated with this element.
-
addElement
Add a form control element to this form.- Parameters:
-
element
- form control to add - Returns:
- this form element, for chaining
-
removeChild
- Overrides:
-
removeChild
in classNode
-
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 inDocument.connection()
You can then set up other options (like user-agent, timeout, cookies), then execute it.
- Returns:
- a connection prepared from the values of this form, in the same session as the one used to request it
- Throws:
-
IllegalArgumentException
- if the form's absolute action URL cannot be determined. Make sure you pass the document's base URI when parsing.
-
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.- Returns:
- a list of key vals
-
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)
.
-