Class HTMLInputElement
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.HTMLInputElement
- All Implemented Interfaces:
Serializable,Cloneable,org.htmlunit.corejs.javascript.ConstProperties,org.htmlunit.corejs.javascript.debug.DebuggableObject,org.htmlunit.corejs.javascript.Scriptable,org.htmlunit.corejs.javascript.SymbolScriptable
The JavaScript object for
HtmlInput.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.htmlunit.javascript.host.html.HTMLElement
HTMLElement.ProxyDomNodeNested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate NodeList"Live" labels collection; has to be a member to have equality (==) working.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_NODEFields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTFields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks whether the element has any constraints and whether it satisfies them.voidclick()Click this element.Returns theacceptattribute.getAlign()Returns the value of thealignproperty.getAlt()Returns the value of thealtproperty.getAttribute(String attributeName) Returns theautocompleteattribute.Returns the input's default value, used if the containing form gets reset.Returns the DOM node that corresponds to this JavaScript object or throw an exception if one cannot be found.getFiles()Returns thefilesproperty.getForm()Returns the value of the JavaScriptformattribute.intReturns theheightproperty.Returns the labels associated with the element.getMax()Gets themaxproperty.intGets the max length.getMin()Gets theminproperty.intGets theminLength.getName()Returns the value of the JavaScript attributename.Returns theplaceholderattribute.Gets the value ofselectionEndattribute.Gets the value ofselectionStartattribute.getSize()Returns thesizeattribute.getSrc()Returns the value of thesrcattribute.getStep()Gets thestepproperty.intGets the value oftextLengthattribute.getType()Returns thetypeproperty.getValue()Returns the value of the JavaScript attributevalue.intgetWidth()Returns thewidthproperty.booleanbooleanReturns the value of the checked property.booleanReturns the input's default checked value, used if the containing form gets reset.booleanReturns true if this element is disabled.protected booleanReturns whether the end tag is forbidden or not.booleanReturns the value of the propertyformnovalidate.booleanGets the value ofreadOnlyattribute.booleanReturns therequiredproperty.voidJavaScript constructor.voidselect()Select this element.voidSets theacceptattribute.voidSets the value of thealignproperty.voidReturns the value of thealtproperty.voidsetAutocomplete(String autocomplete) Sets theautocompleteattribute.voidsetChecked(boolean checked) Sets the checked property.voidsetCustomValidity(String message) Sets the custom validity message for the element to the specified message.voidsetDefaultChecked(boolean defaultChecked) Sets the input's default checked value, used if the containing form gets reset.voidsetDefaultValue(String defaultValue) Sets the input's default value, used if the containing form gets reset.voidsetDisabled(boolean disabled) Sets whether or not to disable this element.voidsetFormNoValidate(boolean value) Sets the value of the propertyformnovalidate.voidsetHeight(int height) Sets theheightproperty.voidSets themaxproperty.voidsetMaxLength(int length) Sets the value ofmaxLengthattribute.voidSets theminproperty.voidsetMinLength(int length) Sets the value ofminLengthattribute.voidSets the value of the JavaScript attributename.voidsetPlaceholder(String placeholder) Sets theplaceholderattribute.voidsetReadOnly(boolean readOnly) Sets the value ofreadOnlyattribute.voidsetRequired(boolean required) Sets therequiredproperty.voidsetSelectionEnd(int end) Sets the value ofselectionEndattribute.voidsetSelectionRange(int start, int end) Sets the selected portion of this input element.voidsetSelectionStart(int start) Sets the value ofselectionStartattribute.voidSets thesizeattribute.voidSets the value of thesrcattribute.voidSets thestepproperty.voidSets the value of the attributetype.voidSets the value of the JavaScript attributevalue.voidsetWidth(int width) Sets thewidthproperty.Methods inherited from class org.htmlunit.javascript.host.html.HTMLElement
blur, focus, getAccessKey, getAlign, getAttributeNode, getAutofocus, getBoundingClientRect, getCh, getChOff, getContentEditable, getDataset, getDir, getDomNodeOrNull, getEnterKeyHint, 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, getWidthOrHeight, isAncestorOfEventTarget, isHidden, isIsContentEditable, isLowerCaseInOuterHtml, isSpellcheck, setAccessKey, setAlign, setAttribute, setAutofocus, setCh, setChOff, setColorAttribute, setContentEditable, setDir, 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, setWidthOrHeight, toStringMethods inherited from class org.htmlunit.javascript.host.Element
after, append, before, closest, createAttributesObject, createEventHandler, 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, webkitMatchesSelectorMethods 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, setNodeValueMethods inherited from class org.htmlunit.javascript.host.event.EventTarget
addEventListener, clearEventListenersContainer, dispatchEvent, executeEventLocally, fireEvent, getEventHandler, getEventListenersContainer, hasEventHandlers, isEventHandlerOnWindow, removeEventListener, setEventHandlerMethods inherited from class org.htmlunit.javascript.HtmlUnitScriptable
clone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setParentScope, setupPromise, setupRejectedPromiseMethods 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, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, 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
-
Field Details
-
labels_
"Live" labels collection; has to be a member to have equality (==) working.
-
-
Constructor Details
-
HTMLInputElement
public HTMLInputElement()Creates an instance.
-
-
Method Details
-
jsConstructor
public void jsConstructor()JavaScript constructor.- Overrides:
jsConstructorin classHTMLElement
-
getType
Returns thetypeproperty.- Returns:
- the
typeproperty
-
setType
Sets the value of the attributetype. Note: this replace the DOM node with a new one.- Parameters:
newType- the new type to set
-
setValue
Sets the value of the JavaScript attributevalue.- Overrides:
setValuein classHTMLElement- Parameters:
newValue- the new value
-
setChecked
public void setChecked(boolean checked) Sets the checked property. Although this property is defined in Input it doesn't make any sense for input's other than checkbox and radio. This implementation does nothing. The implementations in Checkbox and Radio actually do the work.- Parameters:
checked- True if this input should have thecheckedattribute set
-
getDomNodeOrDie
Returns the DOM node that corresponds to this JavaScript object or throw an exception if one cannot be found.- Overrides:
getDomNodeOrDiein classHTMLElement- Returns:
- the DOM node
-
isChecked
public boolean isChecked()Returns the value of the checked property. Although this property is defined in Input it doesn't make any sense for input's other than checkbox and radio. This implementation does nothing. The implementations in Checkbox and Radio actually do the work.- Returns:
- the checked property
-
select
public void select()Select this element. -
getDefaultValue
Returns the input's default value, used if the containing form gets reset.- Returns:
- the input's default value, used if the containing form gets reset
- See Also:
-
setDefaultValue
Sets the input's default value, used if the containing form gets reset.- Parameters:
defaultValue- the input's default value, used if the containing form gets reset- See Also:
-
isDefaultChecked
public boolean isDefaultChecked()Returns the input's default checked value, used if the containing form gets reset.- Returns:
- the input's default checked value, used if the containing form gets reset
- See Also:
-
setDefaultChecked
public void setDefaultChecked(boolean defaultChecked) Sets the input's default checked value, used if the containing form gets reset.- Parameters:
defaultChecked- the input's default checked value, used if the containing form gets reset- See Also:
-
getTextLength
public int getTextLength()Gets the value oftextLengthattribute.- Returns:
- the text length
-
getSelectionStart
Gets the value ofselectionStartattribute.- Returns:
- the selection start
-
setSelectionStart
public void setSelectionStart(int start) Sets the value ofselectionStartattribute.- Parameters:
start- selection start
-
getSelectionEnd
Gets the value ofselectionEndattribute.- Returns:
- the selection end
-
setSelectionEnd
public void setSelectionEnd(int end) Sets the value ofselectionEndattribute.- Parameters:
end- selection end
-
getMaxLength
public int getMaxLength()Gets the max length.- Returns:
- the max length
-
setMaxLength
public void setMaxLength(int length) Sets the value ofmaxLengthattribute.- Parameters:
length- the new value
-
getMinLength
public int getMinLength()Gets theminLength.- Returns:
- the
minLength
-
setMinLength
public void setMinLength(int length) Sets the value ofminLengthattribute.- Parameters:
length- the new value
-
getMin
Gets theminproperty.- Returns:
- the
minproperty
-
setMin
Sets theminproperty.- Parameters:
min- theminproperty
-
getMax
Gets themaxproperty.- Returns:
- the
maxproperty
-
setMax
Sets themaxproperty.- Parameters:
max- themaxproperty
-
getStep
Gets thestepproperty.- Returns:
- the
stepproperty
-
setStep
Sets thestepproperty.- Parameters:
step- thestepproperty
-
isReadOnly
public boolean isReadOnly()Gets the value ofreadOnlyattribute.- Returns:
- the readOnly attribute
-
setReadOnly
public void setReadOnly(boolean readOnly) Sets the value ofreadOnlyattribute.- Parameters:
readOnly- the new value
-
setSelectionRange
public void setSelectionRange(int start, int end) Sets the selected portion of this input element.- Parameters:
start- the index of the first character to selectend- the index of the character after the selection
-
getAlt
Returns the value of thealtproperty.- Returns:
- the value of the
altproperty
-
setAlt
Returns the value of thealtproperty.- Parameters:
alt- the value
-
getAlign
Returns the value of thealignproperty.- Returns:
- the value of the
alignproperty
-
setAlign
Sets the value of thealignproperty.- Parameters:
align- the value of thealignproperty
-
getSrc
Returns the value of thesrcattribute.- Returns:
- the value of the
srcattribute
-
setSrc
Sets the value of thesrcattribute.- Parameters:
src- the new value
-
getValue
Returns the value of the JavaScript attributevalue.- Overrides:
getValuein classHTMLElement- Returns:
- the value of this attribute
-
getAttribute
- Overrides:
getAttributein classElement- Parameters:
attributeName- attribute name- Returns:
- the value of the specified attribute,
nullif the attribute is not defined
-
click
Click this element. This simulates the action of the user clicking with the mouse.- Overrides:
clickin classHTMLElement- Throws:
IOException- if this click triggers a page load that encounters problems
-
isEndTagForbidden
protected boolean isEndTagForbidden()Returns whether the end tag is forbidden or not.- Overrides:
isEndTagForbiddenin classHTMLElement- Returns:
- whether the end tag is forbidden or not
- See Also:
-
isRequired
public boolean isRequired()Returns therequiredproperty.- Returns:
- the
requiredproperty
-
setRequired
public void setRequired(boolean required) Sets therequiredproperty.- Parameters:
required- the new value
-
getSize
Returns thesizeattribute.- Returns:
- the
sizeattribute
-
setSize
Sets thesizeattribute.- Parameters:
size- the newsizevalue
-
getAccept
Returns theacceptattribute.- Returns:
- the
acceptattribute
-
setAccept
Sets theacceptattribute.- Parameters:
accept- the newacceptvalue
-
getAutocomplete
Returns theautocompleteattribute.- Returns:
- the
autocompleteattribute
-
setAutocomplete
Sets theautocompleteattribute.- Parameters:
autocomplete- the newautocompletevalue
-
getFiles
Returns thefilesproperty.- Returns:
- the
filesproperty
-
getPlaceholder
Returns theplaceholderattribute.- Returns:
- the
placeholderattribute
-
setPlaceholder
Sets theplaceholderattribute.- Parameters:
placeholder- the newplaceholdervalue
-
getWidth
public int getWidth()Returns thewidthproperty.- Returns:
- the
widthproperty
-
setWidth
public void setWidth(int width) Sets thewidthproperty.- Parameters:
width- thewidthproperty
-
getHeight
public int getHeight()Returns theheightproperty.- Returns:
- the
heightproperty
-
setHeight
public void setHeight(int height) Sets theheightproperty.- Parameters:
height- theheightproperty
-
getLabels
Returns the labels associated with the element.- Returns:
- the labels associated with the element
-
checkValidity
public boolean checkValidity()Checks whether the element has any constraints and whether it satisfies them.- Returns:
- if the element is valid
-
getName
Returns the value of the JavaScript attributename.- Overrides:
getNamein classHTMLElement- Returns:
- the value of this attribute
-
setName
Sets the value of the JavaScript attributename.- Overrides:
setNamein classHTMLElement- Parameters:
newName- the new name
-
isDisabled
public boolean isDisabled()Returns true if this element is disabled. Overridden to modify browser configurations.- Overrides:
isDisabledin classHTMLElement- Returns:
- true if this element is disabled
-
setDisabled
public void setDisabled(boolean disabled) Sets whether or not to disable this element. Overridden to modify browser configurations.- Overrides:
setDisabledin classHTMLElement- Parameters:
disabled- True if this is to be disabled
-
getForm
Returns the value of the JavaScriptformattribute.- Overrides:
getFormin classHTMLElement- Returns:
- the value of the JavaScript
formattribute
-
getValidity
- Returns:
- a ValidityState with the validity states that this element is in.
-
getWillValidate
public boolean getWillValidate()- Returns:
- whether the element is a candidate for constraint validation
-
setCustomValidity
Sets the custom validity message for the element to the specified message.- Parameters:
message- the new message
-
isFormNoValidate
public boolean isFormNoValidate()Returns the value of the propertyformnovalidate.- Returns:
- the value of this property
-
setFormNoValidate
public void setFormNoValidate(boolean value) Sets the value of the propertyformnovalidate.- Parameters:
value- the new value
-