public abstract class HtmlInput extends HtmlElement implements DisabledElement, SubmittableElement, FormFieldWithNameHistory, ValidatableElement
HtmlElement.DisplayStyle
DomElement.ChildElementsIterator
DomNode.ChildIterator, DomNode.DescendantElementsIterator<T extends DomNode>
Modifier and Type | Field and Description |
---|---|
static String |
TAG_NAME
The HTML tag represented by this element.
|
ATTRIBUTE_CHECKED, ATTRIBUTE_HIDDEN, ATTRIBUTE_REQUIRED, TAB_INDEX_OUT_OF_BOUNDS
ATTRIBUTE_NOT_DEFINED, ATTRIBUTE_VALUE_EMPTY, ID_ATTRIBUTE, NAME_ATTRIBUTE, SRC_ATTRIBUTE, TYPE_ATTRIBUTE, VALUE_ATTRIBUTE
PROPERTY_ELEMENT, READY_STATE_COMPLETE, READY_STATE_INTERACTIVE, READY_STATE_LOADED, READY_STATE_LOADING, READY_STATE_UNINITIALIZED
ATTRIBUTE_DISABLED
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 and Description |
---|
HtmlInput(SgmlPage page,
Map<String,DomAttr> attributes)
Creates an instance.
|
HtmlInput(String qualifiedName,
SgmlPage page,
Map<String,DomAttr> attributes)
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
adjustValueAfterTypeChange(HtmlInput oldInput,
BrowserVersion browserVersion) |
HtmlInput |
changeType(String newType,
boolean setThroughAttribute)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
DomNode |
cloneNode(boolean deep) |
void |
focus()
Sets the focus on this element.
|
String |
getAccept()
Returns the value of the
accept attribute. |
String |
getAcceptAttribute()
Returns the value of the attribute
accept . |
String |
getAccessKeyAttribute()
Returns the value of the attribute
accesskey . |
String |
getAlignAttribute()
Returns the value of the attribute
align . |
String |
getAltAttribute()
Returns the value of the attribute
alt . |
String |
getAutocomplete()
Returns the value of the
autocomplete attribute. |
String |
getCheckedAttribute()
Returns the value of the attribute
checked . |
HtmlElement.DisplayStyle |
getDefaultStyleDisplay()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
String |
getDefaultValue()
Returns the default value to use when this element gets reset, if applicable.
|
String |
getDisabledAttribute()
Returns the value of the attribute
disabled . |
protected Object |
getInternalValue() |
String |
getMax()
Returns the value of the
max attribute. |
protected int |
getMaxLength()
Gets the max length if defined, Integer.MAX_VALUE if none.
|
String |
getMaxLengthAttribute()
Returns the value of the attribute
maxlength . |
String |
getMin()
Returns the value of the
min attribute. |
protected int |
getMinLength()
Gets the min length if defined, Integer.MIN_VALUE if none.
|
String |
getMinLengthAttribute()
Returns the value of the attribute
minlength . |
String |
getNameAttribute()
Returns the value of the attribute
name . |
Collection<String> |
getNewNames()
Get all the names this field got after the original one.
|
String |
getOnBlurAttribute()
Returns the value of the attribute
onblur . |
String |
getOnChangeAttribute()
Returns the value of the attribute
onchange . |
String |
getOnFocusAttribute()
Returns the value of the attribute
onfocus . |
String |
getOnSelectAttribute()
Returns the value of the attribute
onselect . |
String |
getOriginalName()
Gets the first value of the
name attribute of this field before any change. |
String |
getPattern()
Returns the value of the
pattern attribute. |
String |
getPlaceholder()
Returns the value of the
placeholder attribute. |
String |
getRawValue()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
String |
getReadOnlyAttribute()
Returns the value of the attribute
readonly . |
String |
getSize()
Returns the value of the
size attribute. |
String |
getSizeAttribute()
Returns the value of the attribute
size . |
String |
getSrc()
Returns the value of the
src value. |
String |
getSrcAttribute()
Returns the value of the attribute
src . |
String |
getStep()
Returns the value of the
step attribute. |
NameValuePair[] |
getSubmitNameValuePairs()
Returns an array of
NameValuePair s that are the values that will be sent
back to the server whenever this element's containing form is submitted. |
String |
getTabIndexAttribute()
Returns the value of the attribute
tabindex . |
String |
getType() |
String |
getTypeAttribute()
Returns the value of the attribute
type . |
String |
getUseMapAttribute()
Returns the value of the attribute
usemap . |
String |
getValue() |
String |
getValueAttribute()
Return the value of the attribute "value".
|
boolean |
handles(Event event)
Indicates if the provided event can be applied to this node.
|
boolean |
hasPatternMismatchValidityState() |
protected boolean |
isBlankPatternValidated() |
boolean |
isCheckable() |
boolean |
isChecked()
Returns
true if this element is currently selected. |
boolean |
isCustomErrorValidityState() |
protected boolean |
isCustomValidityValid() |
boolean |
isDefaultChecked()
Returns the default checked state to use when this element gets reset, if applicable.
|
boolean |
isDisabled()
Returns
true if the disabled attribute is set for this element. |
boolean |
isFormNoValidate() |
protected boolean |
isMinMaxLengthSupported()
Returns if the input element supports maxlength minlength validation.
|
protected boolean |
isPatternSupported()
Returns if the input element supports pattern validation.
|
boolean |
isReadOnly()
Returns
true if this element is read only. |
protected boolean |
isRequiredSupported()
Returns whether this element supports the
required constraint. |
boolean |
isSubmitable() |
boolean |
isTooShortValidityState() |
boolean |
isValid()
Returns whether this element satisfies all form validation constraints set.
|
boolean |
isValidValidityState() |
boolean |
isValueMissingValidityState() |
protected void |
markValueDirty() |
protected boolean |
propagateClickStateUpdateToParent() |
void |
removeFocus()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
void |
reset()
Returns the value of this element to the default value or checked state (usually what it was at
the time the page was loaded, unless it has been modified via JavaScript).
|
void |
setAccept(String accept)
Sets the
accept attribute. |
protected void |
setAttributeNS(String namespaceURI,
String qualifiedName,
String attributeValue,
boolean notifyAttributeChangeListeners,
boolean notifyMutationObservers)
Sets the value of the attribute specified by namespace and qualified name.
|
void |
setAutocomplete(String autocomplete)
Sets the
autocomplete attribute. |
Page |
setChecked(boolean isChecked)
Sets the
checked attribute, returning the page that occupies this input's window after setting
the attribute. |
void |
setCustomValidity(String message)
Sets the custom validity message for the element to the specified message.
|
void |
setDefaultValue(String defaultValue)
Sets the default value to use when this element gets reset, if applicable.
|
void |
setFormNoValidate(boolean noValidate)
Sets the value of the attribute
formnovalidate . |
void |
setMax(String max)
Sets the
max attribute. |
void |
setMaxLength(int maxLength)
Sets the
maxLength attribute. |
void |
setMin(String min)
Sets the
min attribute. |
void |
setMinLength(int minLength)
Sets the
minLength attribute. |
void |
setPattern(String pattern)
Sets the
pattern attribute. |
void |
setPlaceholder(String placeholder)
Sets the
placeholder attribute. |
void |
setRawValue(String rawValue)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
void |
setReadOnly(boolean isReadOnly)
Sets the
readOnly attribute. |
void |
setSize(String size)
Sets the
size attribute. |
void |
setSrcAttribute(String src)
Sets the
src attribute. |
void |
setStep(String step)
Sets the
step attribute. |
void |
setValue(String newValue)
Sets the value.
|
void |
setValueAttribute(String newValue)
Sets the content of the
value attribute. |
protected void |
unmarkValueDirty() |
protected void |
valueAttributeChanged(String attributeValue,
boolean isValueDirty) |
void |
valueModifiedByJavascript()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
boolean |
willValidate() |
acceptChar, addHtmlAttributeChangeListener, appendChildIfNoneExists, checkChildHierarchy, detach, doType, doType, fireHtmlAttributeAdded, fireHtmlAttributeRemoved, fireHtmlAttributeReplaced, getCanonicalXPath, getElementsByAttribute, getEnclosingElement, getEnclosingForm, getEnclosingFormOrDie, getLangAttribute, getNodeName, getOnClickAttribute, getOnDblClickAttribute, getOneHtmlElementByAttribute, getOnKeyDownAttribute, getOnKeyPressAttribute, getOnKeyUpAttribute, getOnMouseDownAttribute, getOnMouseMoveAttribute, getOnMouseOutAttribute, getOnMouseOverAttribute, getOnMouseUpAttribute, getSrcAttributeNormalized, getTabIndex, getTextDirectionAttribute, getXmlLangAttribute, hasEventHandlers, isAltPressed, isAttributeCaseSensitive, isCtrlPressed, isDisplayed, isHidden, isOptional, isRequired, isShiftPressed, isSubmittableByEnter, notifyAttributeChangeListeners, removeAttribute, removeChild, removeHtmlAttributeChangeListener, setAttributeNode, setHidden, setHidden, setOwningForm, setRequired, type, type, type, type, typeDone
blur, click, click, click, click, click, dblClick, dblClick, doClickFireChangeEvent, doClickFireClickEvent, doClickStateUpdate, fireEvent, fireEvent, getAttribute, getAttributeDirect, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getAttributesMap, getChildElementCount, getChildElements, getElementsByTagName, getElementsByTagNameNS, getEventTargetElement, getFirstElementChild, getId, getLastElementChild, getNodeType, getSchemaTypeInfo, getStaticElementsByTagName, getStyleElement, getStyleElementCaseInSensitive, getStyleMap, getTagName, hasAttribute, hasAttributeNS, hasAttributes, isDisabledElementAndDisabled, isEmptyXmlTagExpanded, isMouseOver, isStateUpdateFirst, matches, mouseDown, mouseDown, mouseMove, mouseMove, mouseOut, mouseOut, mouseOver, mouseOver, mouseUp, mouseUp, preventDefault, printOpeningTagContentAsXml, printXml, removeAttributeNode, removeAttributeNS, removeStyleAttribute, replaceStyleAttribute, rightClick, rightClick, setAttribute, setAttributeNodeNS, setAttributeNS, setDefaults, setId, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setInnerHtml, setNodeValue, toString, writeStyleToElement
getLocalName, getLowercaseName, getNamespaceURI, getPrefix, getQualifiedName, processImportNode, setPrefix
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
setDefaultChecked
hasBadInputValidityState, hasRangeOverflowValidityState, hasRangeUnderflowValidityState, hasTypeMismatchValidityState, isStepMismatchValidityState, isTooLongValidityState
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
public static final String TAG_NAME
public HtmlInput(SgmlPage page, Map<String,DomAttr> attributes)
page
- the page that contains this elementattributes
- the initial attributespublic void setValueAttribute(String newValue)
value
attribute.newValue
- the new valuepublic NameValuePair[] getSubmitNameValuePairs()
Returns an array of NameValuePair
s that are the values that will be sent
back to the server whenever this element's containing form is submitted.
THIS METHOD IS INTENDED FOR THE USE OF THE FRAMEWORK ONLY AND SHOULD NOT BE USED BY CONSUMERS OF HTMLUNIT. USE AT YOUR OWN RISK.
getSubmitNameValuePairs
in interface SubmittableElement
public final String getTypeAttribute()
type
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.type
or an empty string if that attribute isn't definedpublic final String getNameAttribute()
name
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.name
or an empty string if that attribute isn't definedpublic final String getValueAttribute()
Return the value of the attribute "value". Refer to the HTML 4.01 documentation for details on the use of this attribute.
value
or an empty string if that attribute isn't definedpublic String getValue()
public void setValue(String newValue)
newValue
- the new valueprotected void valueAttributeChanged(String attributeValue, boolean isValueDirty)
public final String getCheckedAttribute()
checked
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.checked
or an empty string if that attribute isn't definedpublic final String getDisabledAttribute()
disabled
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.getDisabledAttribute
in interface DisabledElement
disabled
or an empty string if that attribute isn't definedpublic final boolean isDisabled()
true
if the disabled attribute is set for this element.isDisabled
in interface DisabledElement
true
if the disabled attribute is set for this elementpublic final String getReadOnlyAttribute()
readonly
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.readonly
or an empty string if that attribute isn't defined.public final String getSizeAttribute()
size
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.size
or an empty string if that attribute isn't defined.public final String getMaxLengthAttribute()
maxlength
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.maxlength
or an empty string if that attribute isn't defined.protected int getMaxLength()
public final String getMinLengthAttribute()
minlength
. Refer to the
HTML 5
documentation for details on the use of this attribute.minlength
or an empty string if that attribute isn't defined.protected int getMinLength()
public String getSrcAttribute()
src
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.src
or an empty string if that attribute isn't defined.public String getSrc()
src
value.src
valuepublic void setSrcAttribute(String src)
src
attribute.src
- the src
attributepublic final String getAltAttribute()
alt
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.alt
or an empty string if that attribute isn't defined.public final String getUseMapAttribute()
usemap
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.usemap
or an empty string if that attribute isn't defined.public final String getTabIndexAttribute()
tabindex
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.tabindex
or an empty string if that attribute isn't defined.public final String getAccessKeyAttribute()
accesskey
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.accesskey
or an empty string if that attribute isn't defined.public final String getOnFocusAttribute()
onfocus
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.onfocus
or an empty string if that attribute isn't defined.public final String getOnBlurAttribute()
onblur
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.onblur
or an empty string if that attribute isn't defined.public final String getOnSelectAttribute()
onselect
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.onselect
or an empty string if that attribute isn't defined.public final String getOnChangeAttribute()
onchange
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.onchange
or an empty string if that attribute isn't defined.public final String getAcceptAttribute()
accept
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.accept
or an empty string if that attribute isn't defined.public final String getAlignAttribute()
align
. Refer to the
HTML 4.01
documentation for details on the use of this attribute.align
or an empty string if that attribute isn't defined.public void reset()
reset
in interface SubmittableElement
SubmittableElement.reset()
public void setDefaultValue(String defaultValue)
setDefaultValue
in interface SubmittableElement
defaultValue
- the default value to use when this element gets reset, if applicableSubmittableElement.setDefaultValue(String)
public String getDefaultValue()
getDefaultValue
in interface SubmittableElement
SubmittableElement.getDefaultValue()
public String getRawValue()
public void setRawValue(String rawValue)
rawValue
- the new raw valuepublic boolean isDefaultChecked()
false
; only checkboxes and
radio buttons really care what the default checked value is.isDefaultChecked
in interface SubmittableElement
SubmittableElement.isDefaultChecked()
,
HtmlRadioButtonInput.isDefaultChecked()
,
HtmlCheckBoxInput.isDefaultChecked()
public Page setChecked(boolean isChecked)
checked
attribute, returning the page that occupies this input's window after setting
the attribute. Note that the returned page may or may not be the original page, depending on
the presence of JavaScript event handlers, etc.isChecked
- true
if this element is to be selectedpublic void setReadOnly(boolean isReadOnly)
readOnly
attribute.isReadOnly
- true
if this element is read onlypublic boolean isChecked()
true
if this element is currently selected.true
if this element is currently selectedpublic boolean isReadOnly()
true
if this element is read only.true
if this element is read onlyprotected boolean propagateClickStateUpdateToParent()
propagateClickStateUpdateToParent
in class DomElement
Usually the click is propagated to the parent. Overwrite if you
like to disable this.
public boolean handles(Event event)
handles
in class HtmlElement
event
- the eventfalse
if the event can't be appliedprotected void setAttributeNS(String namespaceURI, String qualifiedName, String attributeValue, boolean notifyAttributeChangeListeners, boolean notifyMutationObservers)
setAttributeNS
in class HtmlElement
namespaceURI
- the URI that identifies an XML namespacequalifiedName
- the qualified name (prefix:local) of the attributeattributeValue
- the value of the attributenotifyAttributeChangeListeners
- to notify the associated HtmlAttributeChangeListener
snotifyMutationObservers
- to notify MutationObserver
s or notpublic String getOriginalName()
name
attribute of this field before any change.getOriginalName
in interface FormFieldWithNameHistory
public Collection<String> getNewNames()
getNewNames
in interface FormFieldWithNameHistory
public void valueModifiedByJavascript()
public final void focus()
focus
in class DomElement
public final void removeFocus()
removeFocus
in class DomElement
protected Object getInternalValue()
public HtmlElement.DisplayStyle getDefaultStyleDisplay()
getDefaultStyleDisplay
in class HtmlElement
public String getSize()
size
attribute.size
attributepublic void setSize(String size)
size
attribute.size
- the size
attributepublic void setMaxLength(int maxLength)
maxLength
attribute.maxLength
- the maxLength
attributepublic void setMinLength(int minLength)
minLength
attribute.minLength
- the minLength
attributepublic String getAccept()
accept
attribute.accept
attributepublic void setAccept(String accept)
accept
attribute.accept
- the accept
attributepublic String getAutocomplete()
autocomplete
attribute.autocomplete
attributepublic void setAutocomplete(String autocomplete)
autocomplete
attribute.autocomplete
- the autocomplete
attributepublic String getPlaceholder()
placeholder
attribute.placeholder
attributepublic void setPlaceholder(String placeholder)
placeholder
attribute.placeholder
- the placeholder
attributepublic String getPattern()
pattern
attribute.pattern
attributepublic void setPattern(String pattern)
pattern
attribute.pattern
- the pattern
attributepublic String getMin()
min
attribute.min
attributepublic void setMin(String min)
min
attribute.min
- the min
attributepublic String getMax()
max
attribute.max
attributepublic void setMax(String max)
max
attribute.max
- the max
attributepublic String getStep()
step
attribute.step
attributepublic void setStep(String step)
step
attribute.step
- the step
attributepublic boolean isValid()
HtmlElement
isValid
in class HtmlElement
protected boolean isCustomValidityValid()
protected boolean isRequiredSupported()
HtmlElement
required
constraint.isRequiredSupported
in class HtmlElement
required
constraintprotected boolean isPatternSupported()
protected boolean isBlankPatternValidated()
protected boolean isMinMaxLengthSupported()
public DomNode cloneNode(boolean deep)
cloneNode
in interface Node
cloneNode
in class HtmlElement
public boolean willValidate()
willValidate
in interface ValidatableElement
public void setCustomValidity(String message)
setCustomValidity
in interface ValidatableElement
message
- the new messagepublic boolean isCheckable()
public boolean isSubmitable()
public boolean isCustomErrorValidityState()
isCustomErrorValidityState
in interface ValidatableElement
public boolean hasPatternMismatchValidityState()
hasPatternMismatchValidityState
in interface ValidatableElement
public boolean isTooShortValidityState()
isTooShortValidityState
in interface ValidatableElement
public boolean isValidValidityState()
isValidValidityState
in interface ValidatableElement
public boolean isValueMissingValidityState()
isValueMissingValidityState
in interface ValidatableElement
public final boolean isFormNoValidate()
formnovalidate
or an empty string if that attribute isn't definedpublic final void setFormNoValidate(boolean noValidate)
formnovalidate
.noValidate
- the value of the attribute formnovalidate
public final String getType()
type
propertypublic HtmlInput changeType(String newType, boolean setThroughAttribute)
newType
- the new type to setsetThroughAttribute
- set type value through setAttribute()protected void adjustValueAfterTypeChange(HtmlInput oldInput, BrowserVersion browserVersion)
protected void unmarkValueDirty()
protected void markValueDirty()
Copyright © 2002–2024 Gargoyle Software Inc.. All rights reserved.