Package org.htmlunit.html
Class HtmlForm
- java.lang.Object
-
- org.htmlunit.html.DomNode
-
- org.htmlunit.html.DomNamespaceNode
-
- org.htmlunit.html.DomElement
-
- org.htmlunit.html.HtmlElement
-
- org.htmlunit.html.HtmlForm
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,org.w3c.dom.Element
,org.w3c.dom.Node
public class HtmlForm extends HtmlElement
Wrapper for the HTML element "form".- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.htmlunit.html.HtmlElement
HtmlElement.DisplayStyle
-
Nested classes/interfaces inherited from class org.htmlunit.html.DomElement
DomElement.ChildElementsIterator
-
Nested classes/interfaces inherited from class org.htmlunit.html.DomNode
DomNode.ChildIterator, DomNode.DescendantElementsIterator<T extends DomNode>
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ATTRIBUTE_FORMNOVALIDATE
The "formnovalidate" attribute name.private static java.lang.String
ATTRIBUTE_NOVALIDATE
The "novalidate" attribute name.private boolean
isPreventDefault_
private static org.apache.commons.logging.Log
LOG
private static java.util.regex.Pattern
SUBMIT_CHARSET_PATTERN
private static java.util.HashSet<java.lang.String>
SUBMITTABLE_ELEMENT_NAMES
static java.lang.String
TAG_NAME
The HTML tag represented by this element.-
Fields inherited from class org.htmlunit.html.HtmlElement
ATTRIBUTE_CHECKED, ATTRIBUTE_REQUIRED, TAB_INDEX_OUT_OF_BOUNDS
-
Fields inherited from class org.htmlunit.html.DomElement
ATTRIBUTE_NOT_DEFINED, ATTRIBUTE_VALUE_EMPTY, ID_ATTRIBUTE, NAME_ATTRIBUTE, SRC_ATTRIBUTE, TYPE_ATTRIBUTE, VALUE_ATTRIBUTE
-
Fields inherited from class org.htmlunit.html.DomNode
PROPERTY_ELEMENT, READY_STATE_COMPLETE, READY_STATE_INTERACTIVE, READY_STATE_LOADED, READY_STATE_LOADING, READY_STATE_UNINITIALIZED
-
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
areChildrenValid()
java.lang.String
getAcceptAttribute()
Returns the value of the attributeaccept
.java.lang.String
getAcceptCharsetAttribute()
Returns the value of the attributeaccept-charset
.java.lang.String
getActionAttribute()
Returns the value of the attributeaction
.HtmlButton
getButtonByName(java.lang.String name)
Returns the firstHtmlButton
element in this form that has the specified name.java.util.List<HtmlButton>
getButtonsByName(java.lang.String name)
Returns all theHtmlButton
elements in this form that have the specified name.HtmlRadioButtonInput
getCheckedRadioButton(java.lang.String name)
Returns the first checked radio button with the specified name.java.util.List<HtmlElement>
getElements()
java.lang.String
getEnctypeAttribute()
Returns the value of the attributeenctype
.private <E extends HtmlElement>
java.util.List<E>getFormElementsByAttribute(java.lang.String elementName, java.lang.String attributeName, java.lang.String attributeValue)
Same asHtmlElement.getElementsByAttribute(String, String, String)
but ignoring elements that are contained in a nested form.<I extends HtmlInput>
IgetInputByName(java.lang.String name)
Returns the first input element which is a member of this form and has the specified name.<I extends HtmlInput>
IgetInputByValue(java.lang.String value)
Returns the first input in this form with the specified value.java.util.List<HtmlInput>
getInputsByName(java.lang.String name)
Returns all input elements which are members of this form and have the specified name.java.util.List<HtmlInput>
getInputsByValue(java.lang.String value)
Returns all the inputs in this form with the specified value.java.lang.String
getMethodAttribute()
Returns the value of the attributemethod
.java.lang.String
getNameAttribute()
Returns the value of the attributename
.java.lang.String
getOnResetAttribute()
Returns the value of the attributeonreset
.java.lang.String
getOnSubmitAttribute()
Returns the value of the attributeonsubmit
.java.util.List<NameValuePair>
getParameterListForSubmit(SubmittableElement submitElement)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Returns a list ofNameValuePair
s that represent the data that will be sent to the server when this form is submitted.java.util.List<HtmlRadioButtonInput>
getRadioButtonsByName(java.lang.String name)
Returns all theHtmlRadioButtonInput
elements in this form that have the specified name.java.lang.String
getRelAttribute()
Returns the value of the attributerel
.HtmlSelect
getSelectByName(java.lang.String name)
Returns the firstHtmlSelect
element in this form that has the specified name.java.util.List<HtmlSelect>
getSelectsByName(java.lang.String name)
Returns all theHtmlSelect
elements in this form that have the specified name.private java.nio.charset.Charset
getSubmitCharset()
Returns the charset to use for the form submission.(package private) java.util.Collection<SubmittableElement>
getSubmittableElements(SubmittableElement submitElement)
Returns a collection of elements that represent all the "submittable" elements in this form, assuming that the specified element is used to submit the form.java.lang.String
getTargetAttribute()
Returns the value of the attributetarget
.HtmlTextArea
getTextAreaByName(java.lang.String name)
Returns the firstHtmlTextArea
element in this form that has the specified name.java.util.List<HtmlTextArea>
getTextAreasByName(java.lang.String name)
Returns all theHtmlTextArea
elements in this form that have the specified name.WebRequest
getWebRequest(SubmittableElement submitElement)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Gets the request for a submission of this form with the specified SubmittableElement.protected boolean
isEmptyXmlTagExpanded()
Browsers have problems with self closing form tags.boolean
isNoValidate()
private static boolean
isSubmittable(HtmlElement element, SubmittableElement submitElement)
Returnstrue
if the specified element gets submitted when this form is submitted, assuming that the form is submitted using the specified submit element.boolean
isValid()
Returns whether this element satisfies all form validation constraints set.private static boolean
isValidForSubmission(HtmlElement element, SubmittableElement submitElement)
protected void
preventDefault()
This method is called if the current fired event is canceled bypreventDefault()
.private boolean
relContainsNoreferrer()
Page
reset()
Resets this form to its initial values, returning the page contained by this form's window after the reset.void
setActionAttribute(java.lang.String action)
Sets the value of the attributeaction
.(package private) void
setCheckedRadioButton(HtmlRadioButtonInput radioButtonInput)
Selects the specified radio button in the form.void
setEnctypeAttribute(java.lang.String encoding)
Sets the value of the attributeenctype
.void
setMethodAttribute(java.lang.String method)
Sets the value of the attributemethod
.void
setNameAttribute(java.lang.String name)
Sets the value of the attributename
.void
setNoValidate(boolean noValidate)
Sets the value of the attributenovalidate
.void
setTargetAttribute(java.lang.String target)
Sets the value of the attributetarget
.void
submit(SubmittableElement submitElement)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.private void
updateHtml5Attributes(SubmittableElement submitElement)
Check if element which cause submit contains new html5 attributes (formaction, formmethod, formtarget, formenctype) and override existing values-
Methods inherited from class org.htmlunit.html.HtmlElement
acceptChar, addHtmlAttributeChangeListener, appendChildIfNoneExists, checkChildHierarchy, cloneNode, detach, doType, doType, fireHtmlAttributeAdded, fireHtmlAttributeRemoved, fireHtmlAttributeReplaced, getCanonicalXPath, getDefaultStyleDisplay, getElementsByAttribute, getEnclosingElement, getEnclosingForm, getEnclosingFormOrDie, getLangAttribute, getNodeName, getOnClickAttribute, getOnDblClickAttribute, getOneHtmlElementByAttribute, getOnKeyDownAttribute, getOnKeyPressAttribute, getOnKeyUpAttribute, getOnMouseDownAttribute, getOnMouseMoveAttribute, getOnMouseOutAttribute, getOnMouseOverAttribute, getOnMouseUpAttribute, getSrcAttributeNormalized, getTabIndex, getTextDirectionAttribute, getXmlLangAttribute, handles, hasEventHandlers, isAltPressed, isAttributeCaseSensitive, isCtrlPressed, isDisplayed, isHidden, isOptional, isRequired, isRequiredSupported, isShiftPressed, isSubmittableByEnter, notifyAttributeChangeListeners, removeAttribute, removeChild, removeHtmlAttributeChangeListener, setAttributeNode, setAttributeNS, setOwningForm, setRequired, type, type, type, type, typeDone
-
Methods inherited from class org.htmlunit.html.DomElement
blur, click, click, click, click, click, dblClick, dblClick, doClickFireChangeEvent, doClickFireClickEvent, doClickStateUpdate, fireEvent, fireEvent, focus, getAttribute, getAttributeDirect, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getAttributesMap, getChildElementCount, getChildElements, getElementsByTagName, getElementsByTagNameImpl, getElementsByTagNameNS, getEventTargetElement, getFirstElementChild, getId, getLastElementChild, getNodeType, getQualifiedName, getSchemaTypeInfo, getStyleElement, getStyleElementCaseInSensitive, getStyleMap, getTagName, hasAttribute, hasAttributeNS, hasAttributes, isDisabledElementAndDisabled, isMouseOver, isStateUpdateFirst, matches, mouseDown, mouseDown, mouseMove, mouseMove, mouseOut, mouseOut, mouseOver, mouseOver, mouseUp, mouseUp, printOpeningTagContentAsXml, printXml, propagateClickStateUpdateToParent, removeAttributeNode, removeAttributeNS, removeFocus, removeStyleAttribute, replaceStyleAttribute, rightClick, rightClick, setAttribute, setAttributeNodeNS, setAttributeNS, setDefaults, setId, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setInnerHtml, setNodeValue, toString, writeStyleToElement
-
Methods inherited from class org.htmlunit.html.DomNamespaceNode
getLocalName, getLowercaseName, getNamespaceURI, getPrefix, getQualifiedName, processImportNode, setPrefix
-
Methods inherited from class org.htmlunit.html.DomNode
addCharacterDataChangeListener, addDomChangeListener, appendChild, asNormalizedText, asXml, basicRemove, closest, compareDocumentPosition, fireCharacterDataChanged, fireNodeAdded, fireNodeDeleted, getAncestors, getBaseURI, getByXPath, getByXPath, getChildNodes, getChildren, getDescendants, getDomElementDescendants, getEndColumnNumber, getEndLineNumber, getFeature, getFirstByXPath, getFirstByXPath, getFirstChild, getHtmlElementDescendants, getHtmlPageOrNull, getIndex, getLastChild, getNextElementSibling, getNextSibling, getNodeValue, getOwnerDocument, getPage, getParentNode, getPreviousElementSibling, getPreviousSibling, getReadyState, getScriptableObject, getSelectorList, getStartColumnNumber, getStartLineNumber, getTextContent, getUserData, getVisibleText, hasChildNodes, hasFeature, insertBefore, insertBefore, isAncestorOf, isAncestorOfAny, isAttachedToPage, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, mayBeDisplayed, normalize, notifyIncorrectness, onAddedToDocumentFragment, onAddedToPage, onAllChildrenAddedToPage, parseHtmlSnippet, printChildrenAsXml, querySelector, querySelectorAll, quietlyRemoveAndMoveChildrenTo, remove, removeAllChildren, removeCharacterDataChangeListener, removeChild, removeDomChangeListener, replace, replaceChild, setEndLocation, setParentNode, setReadyState, setScriptableObject, setStartLocation, setTextContent, setUserData
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.w3c.dom.Node
appendChild, compareDocumentPosition, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setPrefix, setTextContent, setUserData
-
-
-
-
Field Detail
-
LOG
private static final org.apache.commons.logging.Log LOG
-
TAG_NAME
public static final java.lang.String TAG_NAME
The HTML tag represented by this element.- See Also:
- Constant Field Values
-
ATTRIBUTE_NOVALIDATE
private static final java.lang.String ATTRIBUTE_NOVALIDATE
The "novalidate" attribute name.- See Also:
- Constant Field Values
-
ATTRIBUTE_FORMNOVALIDATE
public static final java.lang.String ATTRIBUTE_FORMNOVALIDATE
The "formnovalidate" attribute name.- See Also:
- Constant Field Values
-
SUBMITTABLE_ELEMENT_NAMES
private static final java.util.HashSet<java.lang.String> SUBMITTABLE_ELEMENT_NAMES
-
SUBMIT_CHARSET_PATTERN
private static final java.util.regex.Pattern SUBMIT_CHARSET_PATTERN
-
isPreventDefault_
private boolean isPreventDefault_
-
-
Constructor Detail
-
HtmlForm
HtmlForm(java.lang.String qualifiedName, SgmlPage htmlPage, java.util.Map<java.lang.String,DomAttr> attributes)
Creates an instance.- Parameters:
qualifiedName
- the qualified name of the element type to instantiatehtmlPage
- the page that contains this elementattributes
- the initial attributes
-
-
Method Detail
-
submit
public void submit(SubmittableElement submitElement)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Submits this form to the server. If
submitElement
isnull
, then the submission is treated as if it was triggered by JavaScript, and theonsubmit
handler will not be executed.IMPORTANT: Using this method directly is not the preferred way of submitting forms. Most consumers should emulate the user's actions instead, probably by using something like
DomElement.click()
orDomElement.dblClick()
.- Parameters:
submitElement
- the element that caused the submit to occur
-
updateHtml5Attributes
private void updateHtml5Attributes(SubmittableElement submitElement)
Check if element which cause submit contains new html5 attributes (formaction, formmethod, formtarget, formenctype) and override existing values- Parameters:
submitElement
- the element to update
-
areChildrenValid
private boolean areChildrenValid()
-
getWebRequest
public WebRequest getWebRequest(SubmittableElement submitElement)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Gets the request for a submission of this form with the specified SubmittableElement.- Parameters:
submitElement
- the element that caused the submit to occur- Returns:
- the request
-
relContainsNoreferrer
private boolean relContainsNoreferrer()
-
getSubmitCharset
private java.nio.charset.Charset getSubmitCharset()
Returns the charset to use for the form submission. This is the first one from the list provided ingetAcceptCharsetAttribute()
if any or the page's charset else- Returns:
- the charset to use for the form submission
-
getParameterListForSubmit
public java.util.List<NameValuePair> getParameterListForSubmit(SubmittableElement submitElement)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Returns a list ofNameValuePair
s that represent the data that will be sent to the server when this form is submitted. This is primarily intended to aid debugging.- Parameters:
submitElement
- the element used to submit the form, ornull
if the form was submitted by JavaScript- Returns:
- the list of
NameValuePair
s that represent that data that will be sent to the server when this form is submitted
-
reset
public Page reset()
Resets this form to its initial values, returning the page contained by this form's window after the reset. Note that the returned page may or may not be the same as the original page, based on JavaScript event handlers, etc.- Returns:
- the page contained by this form's window after the reset
-
isValid
public boolean isValid()
Returns whether this element satisfies all form validation constraints set.- Overrides:
isValid
in classHtmlElement
- Returns:
- whether this element satisfies all form validation constraints set
-
getSubmittableElements
java.util.Collection<SubmittableElement> getSubmittableElements(SubmittableElement submitElement)
Returns a collection of elements that represent all the "submittable" elements in this form, assuming that the specified element is used to submit the form.- Parameters:
submitElement
- the element used to submit the form, ornull
if the form is submitted by JavaScript- Returns:
- a collection of elements that represent all the "submittable" elements in this form
-
isValidForSubmission
private static boolean isValidForSubmission(HtmlElement element, SubmittableElement submitElement)
-
isSubmittable
private static boolean isSubmittable(HtmlElement element, SubmittableElement submitElement)
Returnstrue
if the specified element gets submitted when this form is submitted, assuming that the form is submitted using the specified submit element.- Parameters:
element
- the element to checksubmitElement
- the element used to submit the form, ornull
if the form is submitted by JavaScript- Returns:
true
if the specified element gets submitted when this form is submitted
-
getInputsByName
public java.util.List<HtmlInput> getInputsByName(java.lang.String name)
Returns all input elements which are members of this form and have the specified name.- Parameters:
name
- the input name to search for- Returns:
- all input elements which are members of this form and have the specified name
-
getFormElementsByAttribute
private <E extends HtmlElement> java.util.List<E> getFormElementsByAttribute(java.lang.String elementName, java.lang.String attributeName, java.lang.String attributeValue)
Same asHtmlElement.getElementsByAttribute(String, String, String)
but ignoring elements that are contained in a nested form.
-
getElements
public java.util.List<HtmlElement> getElements()
- Returns:
- returns a list of all form controls contained in the <form> element or referenced by formId but ignoring elements that are contained in a nested form
-
getInputByName
public final <I extends HtmlInput> I getInputByName(java.lang.String name) throws ElementNotFoundException
Returns the first input element which is a member of this form and has the specified name.- Type Parameters:
I
- the input type- Parameters:
name
- the input name to search for- Returns:
- the first input element which is a member of this form and has the specified name
- Throws:
ElementNotFoundException
- if there is not input in this form with the specified name
-
getSelectsByName
public java.util.List<HtmlSelect> getSelectsByName(java.lang.String name)
Returns all theHtmlSelect
elements in this form that have the specified name.- Parameters:
name
- the name to search for- Returns:
- all the
HtmlSelect
elements in this form that have the specified name
-
getSelectByName
public HtmlSelect getSelectByName(java.lang.String name) throws ElementNotFoundException
Returns the firstHtmlSelect
element in this form that has the specified name.- Parameters:
name
- the name to search for- Returns:
- the first
HtmlSelect
element in this form that has the specified name - Throws:
ElementNotFoundException
- if this form does not contain aHtmlSelect
element with the specified name
-
getButtonsByName
public java.util.List<HtmlButton> getButtonsByName(java.lang.String name)
Returns all theHtmlButton
elements in this form that have the specified name.- Parameters:
name
- the name to search for- Returns:
- all the
HtmlButton
elements in this form that have the specified name
-
getButtonByName
public HtmlButton getButtonByName(java.lang.String name) throws ElementNotFoundException
Returns the firstHtmlButton
element in this form that has the specified name.- Parameters:
name
- the name to search for- Returns:
- the first
HtmlButton
element in this form that has the specified name - Throws:
ElementNotFoundException
- if this form does not contain aHtmlButton
element with the specified name
-
getTextAreasByName
public java.util.List<HtmlTextArea> getTextAreasByName(java.lang.String name)
Returns all theHtmlTextArea
elements in this form that have the specified name.- Parameters:
name
- the name to search for- Returns:
- all the
HtmlTextArea
elements in this form that have the specified name
-
getTextAreaByName
public HtmlTextArea getTextAreaByName(java.lang.String name) throws ElementNotFoundException
Returns the firstHtmlTextArea
element in this form that has the specified name.- Parameters:
name
- the name to search for- Returns:
- the first
HtmlTextArea
element in this form that has the specified name - Throws:
ElementNotFoundException
- if this form does not contain aHtmlTextArea
element with the specified name
-
getRadioButtonsByName
public java.util.List<HtmlRadioButtonInput> getRadioButtonsByName(java.lang.String name)
Returns all theHtmlRadioButtonInput
elements in this form that have the specified name.- Parameters:
name
- the name to search for- Returns:
- all the
HtmlRadioButtonInput
elements in this form that have the specified name
-
setCheckedRadioButton
void setCheckedRadioButton(HtmlRadioButtonInput radioButtonInput)
Selects the specified radio button in the form. Only a radio button that is actually contained in the form can be selected.- Parameters:
radioButtonInput
- the radio button to select
-
getCheckedRadioButton
public HtmlRadioButtonInput getCheckedRadioButton(java.lang.String name)
Returns the first checked radio button with the specified name. If none of the radio buttons by that name are checked, this method returnsnull
.- Parameters:
name
- the name of the radio button- Returns:
- the first checked radio button with the specified name
-
getActionAttribute
public final java.lang.String getActionAttribute()
Returns the value of the attributeaction
. Refer to the HTML 4.01 documentation for details on the use of this attribute.- Returns:
- the value of the attribute
action
or an empty string if that attribute isn't defined
-
setActionAttribute
public final void setActionAttribute(java.lang.String action)
Sets the value of the attributeaction
. Refer to the HTML 4.01 documentation for details on the use of this attribute.- Parameters:
action
- the value of the attributeaction
-
getMethodAttribute
public final java.lang.String getMethodAttribute()
Returns the value of the attributemethod
. Refer to the HTML 4.01 documentation for details on the use of this attribute.- Returns:
- the value of the attribute
method
or an empty string if that attribute isn't defined
-
setMethodAttribute
public final void setMethodAttribute(java.lang.String method)
Sets the value of the attributemethod
. Refer to the HTML 4.01 documentation for details on the use of this attribute.- Parameters:
method
- the value of the attributemethod
-
getNameAttribute
public final java.lang.String getNameAttribute()
Returns the value of the attributename
. Refer to the HTML 4.01 documentation for details on the use of this attribute.- Returns:
- the value of the attribute
name
or an empty string if that attribute isn't defined
-
setNameAttribute
public final void setNameAttribute(java.lang.String name)
Sets the value of the attributename
. Refer to the HTML 4.01 documentation for details on the use of this attribute.- Parameters:
name
- the value of the attributename
-
getEnctypeAttribute
public final java.lang.String getEnctypeAttribute()
Returns the value of the attributeenctype
. Refer to the HTML 4.01 documentation for details on the use of this attribute. "Enctype" is the encoding type used when submitting a form back to the server.- Returns:
- the value of the attribute
enctype
or an empty string if that attribute isn't defined
-
setEnctypeAttribute
public final void setEnctypeAttribute(java.lang.String encoding)
Sets the value of the attributeenctype
. Refer to the HTML 4.01 documentation for details on the use of this attribute. "Enctype" is the encoding type used when submitting a form back to the server.- Parameters:
encoding
- the value of the attributeenctype
-
getOnSubmitAttribute
public final java.lang.String getOnSubmitAttribute()
Returns the value of the attributeonsubmit
. Refer to the HTML 4.01 documentation for details on the use of this attribute.- Returns:
- the value of the attribute
onsubmit
or an empty string if that attribute isn't defined
-
getOnResetAttribute
public final java.lang.String getOnResetAttribute()
Returns the value of the attributeonreset
. Refer to the HTML 4.01 documentation for details on the use of this attribute.- Returns:
- the value of the attribute
onreset
or an empty string if that attribute isn't defined
-
getAcceptAttribute
public final java.lang.String getAcceptAttribute()
Returns the value of the attributeaccept
. Refer to the HTML 4.01 documentation for details on the use of this attribute.- Returns:
- the value of the attribute
accept
or an empty string if that attribute isn't defined
-
getAcceptCharsetAttribute
public final java.lang.String getAcceptCharsetAttribute()
Returns the value of the attributeaccept-charset
. Refer to the HTML 4.01 documentation for details on the use of this attribute.- Returns:
- the value of the attribute
accept-charset
or an empty string if that attribute isn't defined
-
getTargetAttribute
public final java.lang.String getTargetAttribute()
Returns the value of the attributetarget
. Refer to the HTML 4.01 documentation for details on the use of this attribute.- Returns:
- the value of the attribute
target
or an empty string if that attribute isn't defined
-
setTargetAttribute
public final void setTargetAttribute(java.lang.String target)
Sets the value of the attributetarget
. Refer to the HTML 4.01 documentation for details on the use of this attribute.- Parameters:
target
- the value of the attributetarget
-
getRelAttribute
public final java.lang.String getRelAttribute()
Returns the value of the attributerel
. Refer to the HTML 4.01 documentation for details on the use of this attribute.- Returns:
- the value of the attribute
rel
or an empty string if that attribute isn't defined
-
getInputByValue
public <I extends HtmlInput> I getInputByValue(java.lang.String value) throws ElementNotFoundException
Returns the first input in this form with the specified value.- Type Parameters:
I
- the input type- Parameters:
value
- the value to search for- Returns:
- the first input in this form with the specified value
- Throws:
ElementNotFoundException
- if this form does not contain any inputs with the specified value
-
getInputsByValue
public java.util.List<HtmlInput> getInputsByValue(java.lang.String value)
Returns all the inputs in this form with the specified value.- Parameters:
value
- the value to search for- Returns:
- all the inputs in this form with the specified value
-
preventDefault
protected void preventDefault()
This method is called if the current fired event is canceled bypreventDefault()
.The default implementation does nothing.
- Overrides:
preventDefault
in classDomElement
-
isEmptyXmlTagExpanded
protected boolean isEmptyXmlTagExpanded()
Browsers have problems with self closing form tags.- Overrides:
isEmptyXmlTagExpanded
in classDomElement
- Returns:
false
by default
-
isNoValidate
public final boolean isNoValidate()
- Returns:
- the value of the attribute
novalidate
or an empty string if that attribute isn't defined
-
setNoValidate
public final void setNoValidate(boolean noValidate)
Sets the value of the attributenovalidate
.- Parameters:
noValidate
- the value of the attributenovalidate
-
-