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

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.html.HTMLFormElement
All Implemented Interfaces:
ScriptableWithFallbackGetter, Serializable, Cloneable, net.sourceforge.htmlunit.corejs.javascript.Callable, net.sourceforge.htmlunit.corejs.javascript.ConstProperties, net.sourceforge.htmlunit.corejs.javascript.debug.DebuggableObject, net.sourceforge.htmlunit.corejs.javascript.Function, net.sourceforge.htmlunit.corejs.javascript.Scriptable

public class HTMLFormElement
extends HTMLElement
implements net.sourceforge.htmlunit.corejs.javascript.Function

A JavaScript object for a Form.

Version:
$Revision: 7582 $
Author:
Mike Bowler, Daniel Gredler, Kent Tong, Chris Erskine, Marc Guillemot, Ahmed Ashour, Sudhan Moghe, Ronald Brill
See Also:
MSDN documentation, 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
HTMLFormElement()
          Creates an instance.
 
Method Summary
 Object call(net.sourceforge.htmlunit.corejs.javascript.Context cx, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args)
          
 net.sourceforge.htmlunit.corejs.javascript.Scriptable construct(net.sourceforge.htmlunit.corejs.javascript.Context cx, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, Object[] args)
          
 Object get(int index, net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
          Returns the specified indexed property.
 String getAction()
          Returns the value of the JavaScript attribute "action".
 HTMLCollection getElements()
          Returns the value of the JavaScript attribute "elements".
 String getEncoding()
          Returns the value of the JavaScript attribute "encoding".
 int getLength()
          Returns the value of the JavaScript attribute "length".
 String getMethod()
          Returns the value of the JavaScript attribute "method".
 String getName()
          Returns the value of the JavaScript attribute "name".
 Object getOnsubmit()
          Returns the onsubmit event handler for this element.
 String getTarget()
          Returns the value of the JavaScript attribute "target".
protected  Object getWithPreemption(String name)
          Overridden to allow the retrieval of certain form elements by ID or name.
 Object item(Object index, Object subIndex)
          Retrieves a form object or an object from an elements collection.
 void reset()
          Resets this form.
 void setAction(String action)
          Sets the value of the JavaScript attribute "action".
 void setEncoding(String encoding)
          Sets the value of the JavaScript attribute "encoding".
 void setHtmlElement(HtmlElement htmlElement)
          Sets the HTML element that corresponds to this JavaScript object.
 void setMethod(String method)
          Sets the value of the JavaScript attribute "method".
 void setName(String name)
          Sets the value of the JavaScript attribute "name".
 void setOnsubmit(Object onsubmit)
          Sets the onsubmit event handler for this element.
 void setTarget(String target)
          Sets the value of the JavaScript attribute "target".
 void submit()
          Submits the form (at the end of the current script execution).
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement
addBehavior, addComponentRequest, blur, clearAttributes, clearComponentRequest, click, compareVersions, contains, createEventHandler, createTextRange, dispatchEvent, doComponentRequest, doScroll, fixAttributeName, focus, get, getAccessKey, 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, getDisabled, 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, isAttributeName, isComponentInstalled, isHomePage, mergeAttributes, navigateHomePage, parseHtmlSnippet, querySelector, querySelectorAll, readAttributes, removeAttributeNode, removeBehavior, removeExpression, removeNode, scrollIntoView, setAccessKey, setActive, setAlign, setAttribute, setAttributeNode, setCh, setChOff, setClassName, setColorAttribute, setDir, setDisabled, setDomNode, 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, hasInstance, initParentScope, isReadOnlySettable, makeScriptableFor, setCaseSensitive, setDomNode
 
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, 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

HTMLFormElement

public HTMLFormElement()
Creates an instance. A default constructor is required for all JavaScript objects.

Method Detail

setHtmlElement

public void setHtmlElement(HtmlElement htmlElement)
Sets the HTML element that corresponds to this JavaScript object.

Overrides:
setHtmlElement in class SimpleScriptable
Parameters:
htmlElement - the HTML element

getName

public String getName()
Returns the value of the JavaScript attribute "name".

Returns:
the value of this attribute

setName

public void setName(String name)
Sets the value of the JavaScript attribute "name".

Parameters:
name - the new value

getElements

public HTMLCollection getElements()
Returns the value of the JavaScript attribute "elements".

Returns:
the value of this attribute

getLength

public int getLength()
Returns the value of the JavaScript attribute "length". Does not count input type=image elements as browsers (IE6, Firfox 1.7) do (cf MSDN doc)

Returns:
the value of this attribute

getAction

public String getAction()
Returns the value of the JavaScript attribute "action".

Returns:
the value of this attribute

setAction

public void setAction(String action)
Sets the value of the JavaScript attribute "action".

Parameters:
action - the new value

getMethod

public String getMethod()
Returns the value of the JavaScript attribute "method".

Returns:
the value of this attribute

setMethod

public void setMethod(String method)
Sets the value of the JavaScript attribute "method".

Parameters:
method - the new value

getTarget

public String getTarget()
Returns the value of the JavaScript attribute "target".

Returns:
the value of this attribute

getOnsubmit

public Object getOnsubmit()
Returns the onsubmit event handler for this element.

Returns:
the onsubmit event handler for this element

setOnsubmit

public void setOnsubmit(Object onsubmit)
Sets the onsubmit event handler for this element.

Parameters:
onsubmit - the onsubmit event handler for this element

setTarget

public void setTarget(String target)
Sets the value of the JavaScript attribute "target".

Parameters:
target - the new value

getEncoding

public String getEncoding()
Returns the value of the JavaScript attribute "encoding".

Returns:
the value of this attribute

setEncoding

public void setEncoding(String encoding)
Sets the value of the JavaScript attribute "encoding".

Parameters:
encoding - the new value

submit

public void submit()
Submits the form (at the end of the current script execution).


item

public Object item(Object index,
                   Object subIndex)
Retrieves a form object or an object from an elements collection.

Parameters:
index - Integer or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made
subIndex - Optional. Integer that specifies the zero-based index of the object to retrieve when a collection is returned
Returns:
an object or a collection of objects if successful, or null otherwise

reset

public void reset()
Resets this form.


getWithPreemption

protected Object getWithPreemption(String name)
Overridden to allow the retrieval of certain form elements by ID or name.

Overrides:
getWithPreemption in class SimpleScriptable
Parameters:
name - the property name
Returns:
Scriptable.NOT_FOUND if not found

get

public Object get(int index,
                  net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
Returns the specified indexed property.

Specified by:
get in interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
Overrides:
get in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
Parameters:
index - the index of the property
start - the scriptable object that was originally queried for this property
Returns:
the property

call

public Object call(net.sourceforge.htmlunit.corejs.javascript.Context cx,
                   net.sourceforge.htmlunit.corejs.javascript.Scriptable scope,
                   net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
                   Object[] args)

Specified by:
call in interface net.sourceforge.htmlunit.corejs.javascript.Callable
Specified by:
call in interface net.sourceforge.htmlunit.corejs.javascript.Function

construct

public net.sourceforge.htmlunit.corejs.javascript.Scriptable construct(net.sourceforge.htmlunit.corejs.javascript.Context cx,
                                                                       net.sourceforge.htmlunit.corejs.javascript.Scriptable scope,
                                                                       Object[] args)

Specified by:
construct in interface net.sourceforge.htmlunit.corejs.javascript.Function


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