com.gargoylesoftware.htmlunit.html
Class HtmlForm

java.lang.Object
  extended by com.gargoylesoftware.htmlunit.html.DomNode
      extended by com.gargoylesoftware.htmlunit.html.DomNamespaceNode
          extended by com.gargoylesoftware.htmlunit.html.HtmlElement
              extended by com.gargoylesoftware.htmlunit.html.StyledElement
                  extended by com.gargoylesoftware.htmlunit.html.ClickableElement
                      extended by com.gargoylesoftware.htmlunit.html.HtmlForm
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class HtmlForm
extends ClickableElement

Wrapper for the html element "form"

Version:
$Revision: 1.3 $
Author:
Mike Bowler, David K. Taylor, Brad Clarke, Christian Sell, Marc Guillemot, George Murnock, Kent Tong, Ahmed Ashour, Philip Graf
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.gargoylesoftware.htmlunit.html.HtmlElement
HtmlElement.MapEntryWrappingIterator
 
Field Summary
static java.lang.String TAG_NAME
 the HTML tag represented by this element
 
Fields inherited from class com.gargoylesoftware.htmlunit.html.HtmlElement
ATTRIBUTE_NOT_DEFINED, ATTRIBUTE_VALUE_EMPTY
 
Fields inherited from class com.gargoylesoftware.htmlunit.html.DomNode
PROPERTY_ELEMENT, READY_STATE_COMPLETE, READY_STATE_INTERACTIVE, READY_STATE_LOADED, READY_STATE_LOADING, READY_STATE_UNINITIALIZED
 
Method Summary
 java.lang.String getAcceptAttribute()
 Return the value of the attribute "accept".
 java.lang.String getAcceptCharsetAttribute()
 Return the value of the attribute "accept-charset".
 java.lang.String getActionAttribute()
 Return the value of the attribute "action".
 HtmlButton getButtonByName(java.lang.String name)
 Find the first button element with the specified name.
 java.util.List getButtonsByName(java.lang.String name)
 Return all the HtmlButtons that match the specified name
 HtmlRadioButtonInput getCheckedRadioButton(java.lang.String name)
 Return the first checked radio button with the specified name.
 java.lang.String getEnctypeAttribute()
 Return the value of the attribute "enctype".
 HtmlInput getInputByName(java.lang.String name)
 Return the first input with the specified name
 HtmlInput getInputByValue(java.lang.String value)
 Return the first input with the specified value.
 java.util.List getInputsByName(java.lang.String name)
 Return the input tags that have the specified name
 java.util.List getInputsByValue(java.lang.String value)
 Return all the inputs with the specified value.
 java.lang.String getMethodAttribute()
 Return the value of the attribute "method".
 java.lang.String getNameAttribute()
 Return the value of the attribute "name".
 java.lang.String getOnResetAttribute()
 Return the value of the attribute "onreset".
 java.lang.String getOnSubmitAttribute()
 Return the value of the attribute "onsubmit".
 java.util.List getParameterListForSubmit(SubmittableElement submitElement)
 Return a list of KeyValuePairs that represent the data that will be sent to the server on a form submit.
 java.util.List getRadioButtonsByName(java.lang.String name)
 Return a list of HtmlInputs that are of type radio and match the specified name
 HtmlSelect getSelectByName(java.lang.String name)
 Find the first select element with the specified name
 java.util.List getSelectsByName(java.lang.String name)
 Return all the HtmlSelect that match the specified name
 java.util.Collection getSubmittableElements(SubmittableElement submitElement)
 Return a collection of elements that represent all the "submittable" elements in this form
 java.lang.String getTargetAttribute()
 Return the value of the attribute "target".
 HtmlTextArea getTextAreaByName(java.lang.String name)
 Find the first textarea element with the specified name.
 java.util.List getTextAreasByName(java.lang.String name)
 Return all the HtmlTextAreas that match the specified name
 Page reset()
 Reset this form to its initial values.
 void setActionAttribute(java.lang.String action)
 Set the value of the attribute "action".
 void setEnctypeAttribute(java.lang.String encoding)
 Set the value of the attribute "enctype".
 void setMethodAttribute(java.lang.String method)
 Set the value of the attribute "method".
 void setNameAttribute(java.lang.String name)
 Set the value of the attribute "name".
 void setTargetAttribute(java.lang.String target)
 Set the value of the attribute "target".
 Page submit(SubmittableElement submitElement)
 INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.ClickableElement
click, click, dblClick, dblClick, getLangAttribute, getOnClickAttribute, getOnDblClickAttribute, getOnKeyDownAttribute, getOnKeyPressAttribute, getOnKeyUpAttribute, getOnMouseDownAttribute, getOnMouseMoveAttribute, getOnMouseOutAttribute, getOnMouseOverAttribute, getOnMouseUpAttribute, getTextDirectionAttribute, getXmlLangAttribute
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.StyledElement
getClassAttribute, getIdAttribute, getStyleAttribute, getTitleAttribute
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.HtmlElement
addHtmlAttributeChangeListener, appendChildIfNoneExists, cloneDomNode, fireEvent, fireEvent, getAttributeEntriesIterator, getAttributeValue, getChildElementsIterator, getEnclosingElement, getEnclosingForm, getEnclosingFormOrDie, getEventHandler, getHtmlElementById, getHtmlElementsByAttribute, getHtmlElementsByTagName, getHtmlElementsByTagNames, getId, getNodeName, getNodeType, getOneHtmlElementByAttribute, getTagName, hasHtmlElementWithId, isAttributeDefined, keyDown, keyDown, mouseDown, mouseDown, mouseMove, mouseMove, mouseOut, mouseOut, mouseOver, mouseOver, mouseUp, mouseUp, removeAttribute, removeChild, removeEventHandler, removeHtmlAttributeChangeListener, rightClick, rightClick, setAttributeValue, setEventHandler, setEventHandler, setId, toString
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.DomNamespaceNode
getLocalName, getNamespaceURI, getPrefix, getQualifiedName, setPrefix
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.DomNode
addDomChangeListener, appendDomChild, asText, asXml, getAllHtmlChildElements, getByXPath, getChildIterator, getEndColumnNumber, getEndLineNumber, getFirstDomChild, getLastDomChild, getNextDomSibling, getNodeValue, getPage, getParentDomNode, getPreviousDomSibling, getReadyState, getScriptObject, getStartColumnNumber, getStartLineNumber, insertBefore, remove, removeAllChildren, removeDomChangeListener, replace, setNodeValue, setReadyState, setScriptObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TAG_NAME

public static final java.lang.String TAG_NAME
the HTML tag represented by this element

See Also:
Constant Field Values
Method Detail

getAcceptAttribute

public final java.lang.String getAcceptAttribute()
Return the value of the attribute "accept". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "accept" or an empty string if that attribute isn't defined.

getAcceptCharsetAttribute

public final java.lang.String getAcceptCharsetAttribute()
Return the value of the attribute "accept-charset". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "accept-charset" or an empty string if that attribute isn't defined.

getActionAttribute

public final java.lang.String getActionAttribute()
Return the value of the attribute "action". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "action" or an empty string if that attribute isn't defined.

getButtonByName

public HtmlButton getButtonByName(java.lang.String name)
                           throws ElementNotFoundException
Find the first button element with the specified name.

Parameters:
name - The name of the button element.
Returns:
The first button.
Throws:
ElementNotFoundException - If the button cannot be found.

getButtonsByName

public java.util.List getButtonsByName(java.lang.String name)
                                throws ElementNotFoundException
Return all the HtmlButtons that match the specified name

Parameters:
name - The name
Returns:
See above
Throws:
ElementNotFoundException - If no matching buttons were found

getCheckedRadioButton

public HtmlRadioButtonInput getCheckedRadioButton(java.lang.String name)
Return the first checked radio button with the specified name. If none of the radio buttons by that name are checked then return null.

Parameters:
name - The name of the radio button
Returns:
The first checked radio button.

getEnctypeAttribute

public final java.lang.String getEnctypeAttribute()
Return the value of the attribute "enctype". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Enctype is the encoding type used when submitting a form back to the server

Returns:
The value of the attribute "enctype" or an empty string if that attribute isn't defined.

getInputByName

public final HtmlInput getInputByName(java.lang.String name)
                               throws ElementNotFoundException
Return the first input with the specified name

Parameters:
name - The name of the input
Returns:
The input
Throws:
ElementNotFoundException - If no inputs could be found with the specified name.

getInputByValue

public HtmlInput getInputByValue(java.lang.String value)
                          throws ElementNotFoundException
Return the first input with the specified value.

Parameters:
value - The value
Returns:
The first input with the specified value.
Throws:
ElementNotFoundException - If no elements can be found with the specified value.

getInputsByName

public java.util.List getInputsByName(java.lang.String name)
Return the input tags that have the specified name

Parameters:
name - The name of the input
Returns:
A list of HtmlInputs

getInputsByValue

public java.util.List getInputsByValue(java.lang.String value)
Return all the inputs with the specified value.

Parameters:
value - The value
Returns:
all the inputs with the specified value.

getMethodAttribute

public final java.lang.String getMethodAttribute()
Return the value of the attribute "method". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "method" or an empty string if that attribute isn't defined.

getNameAttribute

public final java.lang.String getNameAttribute()
Return the value of the attribute "name". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "name" or an empty string if that attribute isn't defined.

getOnResetAttribute

public final java.lang.String getOnResetAttribute()
Return the value of the attribute "onreset". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "onreset" or an empty string if that attribute isn't defined.

getOnSubmitAttribute

public final java.lang.String getOnSubmitAttribute()
Return the value of the attribute "onsubmit". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "onsubmit" or an empty string if that attribute isn't defined.

getParameterListForSubmit

public final java.util.List getParameterListForSubmit(SubmittableElement submitElement)
Return a list of KeyValuePairs that represent the data that will be sent to the server on a form submit. This is primarily intended to aid debugging.

Parameters:
submitElement - The element that would have been pressed to submit the form or null if the form was submitted by javascript.
Returns:
The list of KeyValuePairs.

getRadioButtonsByName

public java.util.List getRadioButtonsByName(java.lang.String name)
Return a list of HtmlInputs that are of type radio and match the specified name

Parameters:
name - The name
Returns:
See above

getSelectByName

public HtmlSelect getSelectByName(java.lang.String name)
                           throws ElementNotFoundException
Find the first select element with the specified name

Parameters:
name - The name of the select element
Returns:
The first select.
Throws:
ElementNotFoundException - If the select cannot be found.

getSelectsByName

public java.util.List getSelectsByName(java.lang.String name)
Return all the HtmlSelect that match the specified name

Parameters:
name - The name
Returns:
See above

getSubmittableElements

public java.util.Collection getSubmittableElements(SubmittableElement submitElement)
Return a collection of elements that represent all the "submittable" elements in this form

Parameters:
submitElement - The element that would have been pressed to submit the form or null if the form was submitted by javascript.
Returns:
See above

getTargetAttribute

public final java.lang.String getTargetAttribute()
Return the value of the attribute "target". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "target" or an empty string if that attribute isn't defined.

getTextAreaByName

public HtmlTextArea getTextAreaByName(java.lang.String name)
                               throws ElementNotFoundException
Find the first textarea element with the specified name.

Parameters:
name - The name of the textarea element.
Returns:
The first textarea.
Throws:
ElementNotFoundException - If the textarea cannot be found.

getTextAreasByName

public java.util.List getTextAreasByName(java.lang.String name)
Return all the HtmlTextAreas that match the specified name

Parameters:
name - The name
Returns:
See above

reset

public Page reset()
Reset this form to its initial values.

Returns:
The page that is loaded at the end of calling this method. Typically this will be the same page that had been loaded previously but since javascript might have run, this isn't guaranteed.

setActionAttribute

public final void setActionAttribute(java.lang.String action)
Set the value of the attribute "action". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Parameters:
action - The value of the attribute "action"

setEnctypeAttribute

public final void setEnctypeAttribute(java.lang.String encoding)
Set the value of the attribute "enctype". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Enctype is the encoding type used when submitting a form back to the server

Parameters:
encoding - The value of the attribute "enctype" or an empty string if that attribute isn't defined.

setMethodAttribute

public final void setMethodAttribute(java.lang.String method)
Set the value of the attribute "method". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Parameters:
method - The value of the attribute "method" or an empty string if that attribute isn't defined.

setNameAttribute

public final void setNameAttribute(java.lang.String name)
Set the value of the attribute "name". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Parameters:
name - the new value

setTargetAttribute

public final void setTargetAttribute(java.lang.String target)
Set the value of the attribute "target". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Parameters:
target - The value of the attribute "target" or an empty string if that attribute isn't defined.

submit

public Page submit(SubmittableElement submitElement)
            throws java.io.IOException
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Submit this form to the appropriate server. If submitElement is null then treat this as if it was called by javascript. In this case, the onsubmit handler will not get executed.

Parameters:
submitElement - The element that caused the submit to occur
Returns:
A new Page that reflects the results of this submission
Throws:
java.io.IOException - If an IO error occurs


Copyright © 2003-2016 AppPerfect Corporation. All Rights Reserved.