Class HTMLFormElement
- java.lang.Object
-
- org.htmlunit.corejs.javascript.ScriptableObject
-
- org.htmlunit.javascript.HtmlUnitScriptable
-
- org.htmlunit.javascript.host.event.EventTarget
-
- org.htmlunit.javascript.host.dom.Node
-
- org.htmlunit.javascript.host.Element
-
- org.htmlunit.javascript.host.html.HTMLElement
-
- org.htmlunit.javascript.host.html.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 objectHTMLFormElement
.- See Also:
- MSDN documentation, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.htmlunit.javascript.host.html.HTMLElement
HTMLElement.ProxyDomNode
-
-
Field Summary
-
Fields inherited from class org.htmlunit.javascript.host.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
-
-
Constructor Summary
Constructors Constructor Description HTMLFormElement()
Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
boolean
checkValidity()
Checks whether the element has any constraints and whether it satisfies them.org.htmlunit.corejs.javascript.Scriptable
construct(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, java.lang.Object[] args)
boolean
dispatchEvent(Event event)
Dispatches an event into the event system (standards-conformant browsers only).(package private) java.util.List<HtmlElement>
findElements(java.lang.String name)
private HtmlElement
findFirstElement(java.lang.String name)
java.lang.Object
get(int index, org.htmlunit.corejs.javascript.Scriptable start)
Returns the specified indexed property.java.lang.String
getAction()
Returns the value of the propertyaction
.HTMLCollection
getElements()
Returns the value of the propertyelements
.java.lang.String
getEncoding()
Returns the value of the propertyencoding
.java.lang.String
getEnctype()
Returns the value of the propertyenctype
.HtmlForm
getHtmlForm()
int
getLength()
Returns the value of the propertylength
.java.lang.String
getMethod()
Returns the value of the propertymethod
.java.lang.String
getName()
Returns the value of the propertyname
.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.java.lang.String
getRel()
Returns the value of the rel property.DOMTokenList
getRelList()
Returns therelList
attribute.java.lang.String
getTarget()
Returns the value of the propertytarget
.protected java.lang.Object
getWithPreemption(java.lang.String name)
Overridden to allow the retrieval of certain form elements by ID or name.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.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".boolean
isNoValidate()
Returns the value of the propertynovalidate
.org.htmlunit.corejs.javascript.Scriptable
iterator()
void
jsConstructor()
JavaScript constructor.void
requestSubmit(java.lang.Object submitter)
Submits the form by submitted using a specific submit button.void
reset()
Resets this form.void
setAction(java.lang.String action)
Sets the value of the propertyaction
.void
setEncoding(java.lang.String encoding)
Sets the value of the propertyencoding
.void
setEnctype(java.lang.String enctype)
Sets the value of the propertyenctype
.void
setMethod(java.lang.String method)
Sets the value of the propertymethod
.void
setName(java.lang.String name)
Sets the value of the propertyname
.void
setNoValidate(boolean value)
Sets the value of the propertynovalidate
.void
setRel(java.lang.String rel)
Sets the rel property.void
setRelList(java.lang.Object rel)
Sets the relList property.void
setTarget(java.lang.String target)
Sets the value of the propertytarget
.void
submit()
Submits the form (at the end of the current script execution).-
Methods inherited from class org.htmlunit.javascript.host.html.HTMLElement
blur, click, focus, getAccessKey, getAlign, getAttributeNode, getAutofocus, getBoundingClientRect, getCh, getChOff, getContentEditable, getDataset, getDir, getDomNodeOrDie, getDomNodeOrNull, getEnterKeyHint, getForm, getInnerText, getLang, getLocalName, getNodeName, getOffsetHeight, getOffsetLeft, getOffsetParent_js, getOffsetTop, getOffsetWidth, getOnabort, getOnanimationcancel, getOnanimationend, getOnanimationiteration, getOnanimationstart, getOnauxclick, getOnblur, getOncancel, getOncanplay, getOncanplaythrough, getOnchange, getOnclick, getOnclose, getOncontextmenu, getOncopy, getOncuechange, getOncut, getOndblclick, getOndrag, getOndragend, getOndragenter, getOndragleave, getOndragover, getOndragstart, getOndrop, getOndurationchange, getOnemptied, getOnended, getOnerror, getOnfocus, getOngotpointercapture, getOninput, getOninvalid, getOnkeydown, getOnkeypress, getOnkeyup, getOnload, getOnloadeddata, getOnloadedmetadata, getOnloadstart, getOnlostpointercapture, getOnmousedown, getOnmouseenter, getOnmouseleave, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnmousewheel, getOnmozfullscreenchange, getOnmozfullscreenerror, getOnpaste, getOnpause, getOnplay, getOnplaying, getOnpointercancel, getOnpointerdown, getOnpointerenter, getOnpointerleave, getOnpointermove, getOnpointerout, getOnpointerover, getOnpointerup, getOnprogress, getOnratechange, getOnreset, getOnresize, getOnscroll, getOnscrollend, getOnseeked, getOnseeking, getOnselect, getOnselectionchange, getOnselectstart, getOnstalled, getOnsubmit, getOnsuspend, getOntimeupdate, getOntoggle, getOntransitioncancel, getOntransitionend, getOntransitionrun, getOntransitionstart, getOnvolumechange, getOnwaiting, getOnwheel, getOuterText, getParentHTMLElement, getPosX, getPosY, getPrefix, getStyle, getTabIndex, getTitle, getVAlign, getValue, getWidthOrHeight, isAncestorOfEventTarget, isDisabled, isEndTagForbidden, isHidden, isIsContentEditable, isLowerCaseInOuterHtml, isSpellcheck, setAccessKey, setAlign, setAttribute, setAutofocus, setCh, setChOff, setColorAttribute, setContentEditable, setDir, setDisabled, setDomNode, setEnterKeyHint, setHidden, setInnerText, setLang, setOnabort, setOnanimationcancel, setOnanimationend, setOnanimationiteration, setOnanimationstart, setOnauxclick, setOnblur, setOncancel, setOncanplay, setOncanplaythrough, setOnchange, setOnclick, setOnclose, setOncontextmenu, setOncopy, setOncuechange, setOncut, setOndblclick, setOndrag, setOndragend, setOndragenter, setOndragleave, setOndragover, setOndragstart, setOndrop, setOndurationchange, setOnemptied, setOnended, setOnerror, setOnfocus, setOngotpointercapture, setOninput, setOninvalid, setOnkeydown, setOnkeypress, setOnkeyup, setOnload, setOnloadeddata, setOnloadedmetadata, setOnloadstart, setOnlostpointercapture, setOnmousedown, setOnmouseenter, setOnmouseleave, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnmousewheel, setOnmozfullscreenchange, setOnmozfullscreenerror, setOnpaste, setOnpause, setOnplay, setOnplaying, setOnpointercancel, setOnpointerdown, setOnpointerenter, setOnpointerleave, setOnpointermove, setOnpointerout, setOnpointerover, setOnpointerup, setOnprogress, setOnratechange, setOnreset, setOnresize, setOnscroll, setOnscrollend, setOnseeked, setOnseeking, setOnselect, setOnselectionchange, setOnselectstart, setOnstalled, setOnsubmit, setOnsuspend, setOntimeupdate, setOntoggle, setOntransitioncancel, setOntransitionend, setOntransitionrun, setOntransitionstart, setOnvolumechange, setOnwaiting, setOnwheel, setOuterText, setSpellcheck, setStyle, setTabIndex, setTextContent, setTitle, setVAlign, setValue, setWidthOrHeight, toString
-
Methods inherited from class org.htmlunit.javascript.host.Element
after, append, before, closest, createAttributesObject, createEventHandler, getAttribute, getAttributeNodeNS, getAttributeNS, getAttributes, getChildElementCount, getChildren, getClassList, getClassName_js, getClientHeight, getClientLeft, getClientRects, getClientTop, getClientWidth, getElementsByClassName, getElementsByTagName, getElementsByTagNameNS, getFirstElementChild, getId, getInnerHTML, getInnerHTML, getLastElementChild, getNamespaceURI, getNextElementSibling, getOnbeforecopy, getOnbeforecut, getOnbeforepaste, getOnsearch, getOnwebkitfullscreenchange, getOnwebkitfullscreenerror, getOuterHTML, getParentElement, getPreviousElementSibling, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getTagName, hasAttribute, hasAttributeNS, hasAttributes, innerHTML, insertAdjacentElement, insertAdjacentHTML, insertAdjacentText, isDisplayNone, matches, mozMatchesSelector, prepend, printChildren, printNode, querySelector, querySelectorAll, releaseCapture, remove, removeAttribute, removeAttributeNode, removeAttributeNS, replaceChildren, replaceWith, scroll, scrollBy, scrollIntoView, scrollIntoViewIfNeeded, scrollTo, setAttributeNode, setAttributeNS, setCapture, setClassName_js, setId, setInnerHTML, setOnbeforecopy, setOnbeforecut, setOnbeforepaste, setOnsearch, setOnwebkitfullscreenchange, setOnwebkitfullscreenerror, setOuterHTML, setScrollLeft, setScrollTop, toggleAttribute, webkitMatchesSelector
-
Methods inherited from class org.htmlunit.javascript.host.dom.Node
after, append, appendChild, before, cloneNode, compareDocumentPosition, contains, getBaseURI, getChildNodes, getFirstChild, getJavaScriptNode, getLastChild, getNextSibling, getNodeType, getNodeValue, getOwnerDocument, getParent, getParentNode, getPreviousSibling, getRootNode, getTextContent, hasChildNodes, insertBefore, insertBeforeImpl, isEqualNode, isSameNode, normalize, prepend, removeChild, replaceChild, replaceChildren, replaceWith, setNodeValue
-
Methods inherited from class org.htmlunit.javascript.host.event.EventTarget
addEventListener, clearEventListenersContainer, executeEventLocally, fireEvent, getEventHandler, getEventListenersContainer, hasEventHandlers, isEventHandlerOnWindow, removeEventListener, setEventHandler
-
Methods inherited from class org.htmlunit.javascript.HtmlUnitScriptable
clone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setParentScope, setupPromise, setupRejectedPromise
-
Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
-
-
-
-
Method Detail
-
jsConstructor
public void jsConstructor()
JavaScript constructor.- Overrides:
jsConstructor
in classHTMLElement
-
getName
public java.lang.String getName()
Returns the value of the propertyname
.- Overrides:
getName
in classHTMLElement
- Returns:
- the value of this property
-
setName
public void setName(java.lang.String name)
Sets the value of the propertyname
.- Overrides:
setName
in classHTMLElement
- Parameters:
name
- the new value
-
getElements
public HTMLCollection getElements()
Returns the value of the propertyelements
.- Returns:
- the value of this property
-
iterator
public org.htmlunit.corejs.javascript.Scriptable iterator()
-
getLength
public int getLength()
- Returns:
- the value of this property
-
getAction
public java.lang.String getAction()
Returns the value of the propertyaction
.- Returns:
- the value of this property
-
setAction
public void setAction(java.lang.String action)
Sets the value of the propertyaction
.- Parameters:
action
- the new value
-
getMethod
public java.lang.String getMethod()
Returns the value of the propertymethod
.- Returns:
- the value of this property
-
setMethod
public void setMethod(java.lang.String method)
Sets the value of the propertymethod
.- Parameters:
method
- the new property
-
getTarget
public java.lang.String getTarget()
Returns the value of the propertytarget
.- Returns:
- the value of this property
-
setTarget
public void setTarget(java.lang.String target)
Sets the value of the propertytarget
.- 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 therelList
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 propertyenctype
.- Returns:
- the value of this property
-
setEnctype
public void setEnctype(java.lang.String enctype)
Sets the value of the propertyenctype
.- Parameters:
enctype
- the new value
-
getEncoding
public java.lang.String getEncoding()
Returns the value of the propertyencoding
.- Returns:
- the value of this property
-
setEncoding
public void setEncoding(java.lang.String encoding)
Sets the value of the propertyencoding
.- 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 classHtmlUnitScriptable
- 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 interfaceorg.htmlunit.corejs.javascript.Scriptable
- Overrides:
has
in classorg.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 classorg.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 testname
- 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 interfaceorg.htmlunit.corejs.javascript.Scriptable
- Overrides:
get
in classorg.htmlunit.corejs.javascript.ScriptableObject
- Parameters:
index
- the index of the propertystart
- 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 interfaceorg.htmlunit.corejs.javascript.Callable
- Specified by:
call
in interfaceorg.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 interfaceorg.htmlunit.corejs.javascript.Constructable
- Specified by:
construct
in interfaceorg.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 classEventTarget
- Parameters:
event
- the event to be dispatched- Returns:
false
if at least one of the event handlers which handled the event calledpreventDefault
;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 propertynovalidate
.- Returns:
- the value of this property
-
setNoValidate
public void setNoValidate(boolean value)
Sets the value of the propertynovalidate
.- Parameters:
value
- the new value
-
-