com.gargoylesoftware.htmlunit.javascript.host.html
Class HTMLInputElement

java.lang.Object
  extended by net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
      extended by com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
          extended by com.gargoylesoftware.htmlunit.javascript.host.Node
              extended by com.gargoylesoftware.htmlunit.javascript.host.EventNode
                  extended by com.gargoylesoftware.htmlunit.javascript.host.Element
                      extended by com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement
                          extended by com.gargoylesoftware.htmlunit.javascript.host.FormChild
                              extended by com.gargoylesoftware.htmlunit.javascript.host.FormField
                                  extended by com.gargoylesoftware.htmlunit.javascript.host.html.HTMLInputElement
All Implemented Interfaces:
ScriptableWithFallbackGetter, Serializable, Cloneable, net.sourceforge.htmlunit.corejs.javascript.ConstProperties, net.sourceforge.htmlunit.corejs.javascript.debug.DebuggableObject, net.sourceforge.htmlunit.corejs.javascript.Scriptable

public class HTMLInputElement
extends FormField

The JavaScript object for form input elements (html tag <input ...>).

Version:
$Revision: 7582 $
Author:
Mike Bowler, Christian Sell, Marc Guillemot, Chris Erskine, Ahmed Ashour, Daniel Gredler
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement
HTMLElement.ProxyDomNode
 
Field Summary
 
Fields inherited from class com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement
BEHAVIOR_ID_CLIENT_CAPS, BEHAVIOR_ID_DOWNLOAD, BEHAVIOR_ID_HOMEPAGE
 
Fields inherited from class com.gargoylesoftware.htmlunit.javascript.host.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
 
Fields inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 
Fields inherited from interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
HTMLInputElement()
          Creates an instance.
 
Method Summary
 void click()
          Click this element.
 String getAccessKey()
          Returns the "accessKey" property.
 String getAlign()
          Returns the value of the "align" property.
 String getAlt()
          Returns the value of the "alt" property.
 String getBorder()
          Gets the "border" attribute.
 boolean getChecked()
          Returns the value of the checked property.
 boolean getDefaultChecked()
          Returns the input's default checked value, used if the containing form gets reset.
 String getDefaultValue()
          Returns the input's default value, used if the containing form gets reset.
protected  HtmlInput getHtmlInputOrDie()
          Commodity for (HtmlInput) getDomNodeOrDie().
 int getMaxLength()
          Gets the max length.
 boolean getReadOnly()
          Gets the value of "readOnly" attribute.
 int getSelectionEnd()
          Gets the value of "selectionEnd" attribute.
 int getSelectionStart()
          Gets the value of "selectionStart" attribute.
 int getTextLength()
          Gets the value of "textLength" attribute.
 String getType()
          Returns the value of the JavaScript attribute "type".
protected  boolean isAttributeName(String name)
          Indicates if this is the name of a well defined attribute that can be access as property.
 void select()
          Select this element.
 void setAccessKey(String accessKey)
          Sets the "accessKey" property.
 void setAlign(String align)
          Sets the value of the "align" property.
 void setAlt(String alt)
          Returns the value of the "alt" property.
 void setAttribute(String name, String value)
          Uses setType(String) if attribute's name is type to replace DOM node as well as long as we have subclasses of HtmlInput.
 void setBorder(String border)
          Sets the "border" attribute.
 void setChecked(boolean checked)
          Sets the checked property.
 void setDefaultChecked(boolean defaultChecked)
          Sets the input's default checked value, used if the containing form gets reset.
 void setDefaultValue(String defaultValue)
          Sets the input's default value, used if the containing form gets reset.
 void setMaxLength(int length)
          Sets the value of "maxLength" attribute.
 void setReadOnly(boolean readOnly)
          Sets the value of "readOnly" attribute.
 void setSelectionEnd(int end)
          Sets the value of "selectionEnd" attribute.
 void setSelectionRange(int start, int end)
          Sets the selected portion of this input element.
 void setSelectionStart(int start)
          Sets the value of "selectionStart" attribute.
 void setType(String newType)
          Sets the value of the attribute "type".
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.FormField
getDisabled, getName, getOnchange, getValue, setDisabled, setDomNode, setName, setOnchange, setValue
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.FormChild
getForm
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement
addBehavior, addComponentRequest, blur, clearAttributes, clearComponentRequest, compareVersions, contains, createEventHandler, createTextRange, dispatchEvent, doComponentRequest, doScroll, fixAttributeName, focus, get, getAlign, getAll, getAttribute, getAttributeNode, getAttributeNodeNS, getAvailHeight, getAvailWidth, getBoundingClientRect, getBoxObject, getBufferDepth, getCh, getChildren, getChOff, getClassList, getClassName_js, getClientHeight, getClientLeft, getClientRects, getClientTop, getClientWidth, getColorDepth, getComponentVersion, getConnectionType, getCookieEnabled, getCpuClass, getCurrentStyle, getDir, getDocument, getDomNodeOrDie, getDomNodeOrNull, getElementsByClassName, getFilters, getHeight, getId, getInnerHTML, getInnerText, getJavaEnabled, getLang, getLanguage, getLocalName, getNamespaceURI, getNodeName, getOffsetHeight, getOffsetLeft, getOffsetParent_js, getOffsetTop, getOffsetWidth, getOuterHTML, getParentElement, getParentHTMLElement, getPlatform, getPosX, getPosY, getPrefix, getRuntimeStyle, getScopeName, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getSpellcheck, getStyle, getSystemLanguage, getTabIndex, getTagName, getTagUrn, getTitle, getUniqueID, getUserLanguage, getVAlign, getWidth, getWidthOrHeight, getWithFallback, hasAttribute, insertAdjacentElement, insertAdjacentHTML, isAncestorOfEventTarget, isComponentInstalled, isHomePage, mergeAttributes, navigateHomePage, parseHtmlSnippet, querySelector, querySelectorAll, readAttributes, removeAttributeNode, removeBehavior, removeExpression, removeNode, scrollIntoView, setActive, setAlign, setAttributeNode, setCh, setChOff, setClassName, setColorAttribute, setDir, setExpression, setHomePage, setId, setInnerHTML, setInnerText, setLang, setLanguage, setOuterHTML, setScrollLeft, setScrollTop, setSpellcheck, setTabIndex, setTagUrn, setTextContent, setTitle, setVAlign, setWidthOrHeight, startDownload, toString
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.Element
createAttributesObject, getAttributeNS, getAttributes, getBaseURI, getChildElementCount, getElementsByTagName, getElementsByTagNameNS, getFirstElementChild, getLastElementChild, getNextElementSibling, getPreviousElementSibling, getText, hasAttributeNS, removeAttribute, removeAttributeNS, selectNodes, selectSingleNode, setAttributeNS, setDefaults
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.EventNode
fireEvent, getOnblur, getOnclick, getOncontextmenu, getOndblclick, getOnerror, getOnfocus, getOnfocusin, getOnfocusout, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnpropertychange, getOnresize, setOnblur, setOnclick, setOncontextmenu, setOndblclick, setOnerror, setOnfocus, setOnfocusin, setOnfocusout, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnpropertychange, setOnresize
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.Node
addEventListener, appendChild, attachEvent, cloneNode, compareDocumentPosition, detachEvent, executeEvent, fireEvent, fireEvent, getChildNodes, getEventHandler, getEventHandlerProp, getFirstChild, getJavaScriptNode, getLastChild, getNextSibling, getNodeType, getNodeValue, getOwnerDocument, getParent, getParentNode, getPreviousSibling, getTextContent, getXml, hasChildNodes, hasEventHandlers, insertBefore, insertBeforeImpl, isSameNode, normalize, removeChild, removeEventListener, replaceChild, setEventHandler, setEventHandlerProp, setNodeValue
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
clone, defineFunctionProperties, defineProperty, equivalentValues, getBrowserVersion, getClassName, getDefaultValue, getPrototype, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, isReadOnlySettable, makeScriptableFor, setCaseSensitive, setDomNode, setHtmlElement
 
Methods inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype, size
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
delete, delete, get, getClassName, getDefaultValue, getIds, getParentScope, getPrototype, has, has, hasInstance, put, put, setParentScope, setPrototype
 

Constructor Detail

HTMLInputElement

public HTMLInputElement()
Creates an instance.

Method Detail

setType

public void setType(String newType)
Sets the value of the attribute "type". Note: this replace the DOM node with a new one.

Parameters:
newType - the new type to set

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 the "checked" attribute set

getHtmlInputOrDie

protected HtmlInput getHtmlInputOrDie()
Commodity for (HtmlInput) getDomNodeOrDie().

Returns:
the bound HTML input

getChecked

public boolean getChecked()
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.


setAttribute

public void setAttribute(String name,
                         String value)
Uses setType(String) if attribute's name is type to replace DOM node as well as long as we have subclasses of HtmlInput. Sets an attribute. See also the DOM reference

Overrides:
setAttribute in class HTMLElement
Parameters:
name - Name of the attribute to set
value - Value to set the attribute to

getDefaultValue

public String 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:
MSDN Documentation

setDefaultValue

public void setDefaultValue(String defaultValue)
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:
MSDN Documentation

getDefaultChecked

public boolean getDefaultChecked()
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:
MSDN Documentation

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:
MSDN Documentation

getTextLength

public int getTextLength()
Gets the value of "textLength" attribute.

Returns:
the text length

getSelectionStart

public int getSelectionStart()
Gets the value of "selectionStart" attribute.

Returns:
the selection start

setSelectionStart

public void setSelectionStart(int start)
Sets the value of "selectionStart" attribute.

Parameters:
start - selection start

getSelectionEnd

public int getSelectionEnd()
Gets the value of "selectionEnd" attribute.

Returns:
the selection end

setSelectionEnd

public void setSelectionEnd(int end)
Sets the value of "selectionEnd" attribute.

Parameters:
end - selection end

isAttributeName

protected boolean isAttributeName(String name)
Indicates if this is the name of a well defined attribute that can be access as property. Ex: for HtmlInputElement maxlength => false but maxLength => true

Overrides:
isAttributeName in class HTMLElement
Parameters:
name - the name (case sensitive!)
Returns:
false if no standard attribute exists with this name

getMaxLength

public int getMaxLength()
Gets the max length.

Returns:
the max length

setMaxLength

public void setMaxLength(int length)
Sets the value of "maxLength" attribute.

Parameters:
length - the new value

getReadOnly

public boolean getReadOnly()
Gets the value of "readOnly" attribute.

Returns:
the readOnly attribute

setReadOnly

public void setReadOnly(boolean readOnly)
Sets the value of "readOnly" attribute.

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 select
end - the index of the character after the selection

getAlt

public String getAlt()
Returns the value of the "alt" property.

Returns:
the value of the "alt" property

setAlt

public void setAlt(String alt)
Returns the value of the "alt" property.

Parameters:
alt - the value

getBorder

public String getBorder()
Gets the "border" attribute.

Returns:
the "border" attribute

setBorder

public void setBorder(String border)
Sets the "border" attribute.

Parameters:
border - the "border" attribute

getAlign

public String getAlign()
Returns the value of the "align" property.

Returns:
the value of the "align" property

setAlign

public void setAlign(String align)
Sets the value of the "align" property.

Parameters:
align - the value of the "align" property

getAccessKey

public String getAccessKey()
Returns the "accessKey" property. Overridden to modify browser configurations.

Overrides:
getAccessKey in class HTMLElement
Returns:
the "accessKey" property

setAccessKey

public void setAccessKey(String accessKey)
Sets the "accessKey" property. Overridden to modify browser configurations.

Overrides:
setAccessKey in class HTMLElement
Parameters:
accessKey - the "accessKey" property

click

public void click()
           throws IOException
Click this element. This simulates the action of the user clicking with the mouse. Overridden to modify browser configurations.

Overrides:
click in class HTMLElement
Throws:
IOException - if this click triggers a page load that encounters problems

getType

public String getType()
Returns the value of the JavaScript attribute "type". Overridden to modify browser configurations.

Overrides:
getType in class FormField
Returns:
the value of this attribute


Copyright © 2002-2012 Gargoyle Software Inc.. All Rights Reserved.