objectivehtml.htmlwidget
Class HtmlForm

java.lang.Object
  |
  +--objectivehtml.oms.OMSObject
        |
        +--objectivehtml.htmlwidget.HtmlElement
              |
              +--objectivehtml.htmlwidget.HtmlWidget
                    |
                    +--objectivehtml.htmlwidget.HtmlContainerWidget
                          |
                          +--objectivehtml.htmlwidget.HtmlUnrestrictedContainerWidget
                                |
                                +--objectivehtml.htmlwidget.HtmlForm

public class HtmlForm
extends HtmlUnrestrictedContainerWidget

This class represents a html form. i.e.

<form ... >

It is the top-most object in the object hierarchy. An instance of this class must be created first before any other HtmlWidget objects can exist. The widget has no visual presentation but contains submission properties and also can provide properties to its children.

All forms have an action and method type. The action is a URL address and is used by the server to determine what action to perform. The method determines the protocol the form will use to submit data to the server. The typical values are "post" and "get" (default).

This object keeps a list of all the control names used in this form and ensures HtmlControlWidget objects have a unique name.

The widget emits these signals:


Field Summary
static java.lang.String GET
          This constant represents the "get" submission method.
static java.lang.String POST
          This constant represents the "post" submisison method.
 
Fields inherited from class objectivehtml.htmlwidget.HtmlContainerWidget
m_alChildrenWidgets, m_bAutoEscape, m_sText
 
Fields inherited from class objectivehtml.htmlwidget.HtmlWidget
m_bDestroyed, m_bVisible, m_objHtmlForm, m_objParentWidget
 
Fields inherited from class objectivehtml.htmlwidget.HtmlElement
m_hmAttributes, m_sEndTag, m_sQuoteType, m_sStartTag
 
Constructor Summary
HtmlForm()
          Constructs an instance of a HtmlForm.
 
Method Summary
protected  void addControlName(java.lang.String sName)
          Adds a new control name to the form.
protected  void addRadioButton(HtmlRadioButton objRadioButton)
          Adds a new HtmlRadioButton object to the form.
 Signal afterUpdateData(javax.servlet.http.HttpServletRequest objRequest)
          This signal is emitted just after the updateData(HttpServletRequest) method updates all the form object with the submitted data.
 Signal beforeUpdateData(javax.servlet.http.HttpServletRequest objRequest)
          This signal is emitted just before the updateData(HttpServletRequest) method updates all the form object with the submitted data.
 java.lang.String getAction()
          Returns the action of this object.
 java.lang.String getMethod()
          Returns the method of this object.
 java.lang.String getName()
          Returns the method of this object.
protected  HtmlRadioButtonGroup getRadioButtonGroup(java.lang.String sGroupName)
          Returns a reference to the radio button group with the specified name.
protected  void removeControlName(java.lang.String sName)
          Removes a control name from the form.
protected  void removeRadioButton(HtmlRadioButton objRadioButton)
          Removes a HtmlRadioButton object from the form.
 void setAction(java.lang.String sAction)
          Sets the action of this form.
 void setMethod(java.lang.String sMethod)
          Sets the submit method of this form.
 void setName(java.lang.String sName)
          Sets the name of this form.
 void updateData(javax.servlet.http.HttpServletRequest objRequest)
          Updates all HtmlControlWidget objects with the data submitted from the client.
 
Methods inherited from class objectivehtml.htmlwidget.HtmlUnrestrictedContainerWidget
appendChild, destroy, insertChild, setVisible
 
Methods inherited from class objectivehtml.htmlwidget.HtmlContainerWidget
addHtmlWidget, generateUpdateOrder, getChildrenCount, getChildrenWidgets, getChildWidget, getText, indexOfChildWidget, insertHtmlWidget, isAutoEscape, isChildWidget, isValidChildWidget, printHtml, printHtml, removeHtmlWidget, setAttribute, setAutoEscape, setBooleanAttribute, setText, swapHtmlWidgets
 
Methods inherited from class objectivehtml.htmlwidget.HtmlWidget
changeParent, changeParent, getClassAttribute, getHtmlForm, getID, getOnClick, getOnDblClick, getOnKeyDown, getOnKeyPress, getOnKeyUp, getOnMouseDown, getOnMouseMove, getOnMouseOut, getOnMouseOver, getOnMouseUp, getParent, getStyle, isDestroyed, isVisible, setClassAttribute, setID, setOnClick, setOnDblClick, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setStyle
 
Methods inherited from class objectivehtml.htmlwidget.HtmlElement
genEndTag, genStartTag, genStartTag, getAttribute, getAttributes, getBooleanAttribute, getQuoteType, printHtml, printHtml, printHtml, printHtml, printHtml, printHtml, setAttribute, setBooleanAttribute, setQuoteType, toString, toString
 
Methods inherited from class objectivehtml.oms.OMSObject
compareClasses, connect, disconnect, emit, isAlive, setAlive, signal, slot, slot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GET

public static final java.lang.String GET
This constant represents the "get" submission method.

POST

public static final java.lang.String POST
This constant represents the "post" submisison method.
Constructor Detail

HtmlForm

public HtmlForm()
Constructs an instance of a HtmlForm. The default method type is "get".
Method Detail

getRadioButtonGroup

protected HtmlRadioButtonGroup getRadioButtonGroup(java.lang.String sGroupName)
Returns a reference to the radio button group with the specified name.
Parameters:
sGroupName - the radio button group name
Returns:
the HtmlRadioButtonGroup object associated with the name sGroupName

removeRadioButton

protected void removeRadioButton(HtmlRadioButton objRadioButton)

Removes a HtmlRadioButton object from the form.

If the group for this radio button has other radio buttons then the control name and the group will remain. If the radio button is the last radio button in the group then the control name will be removed and the radio group will also be removed.

Parameters:
objRadioButton - the radio button to remove
See Also:
addRadioButton(HtmlRadioButton)

addRadioButton

protected void addRadioButton(HtmlRadioButton objRadioButton)
                       throws InvalidControlNameException

Adds a new HtmlRadioButton object to the form.

If the group of the radio button already exists then it will be added to the group, otherwise a new radio button group is created.

Parameters:
objRadioButton - the radio button to add
Throws:
InvalidControlNameException - if the control name is not valid
See Also:
removeRadioButton(HtmlRadioButton)

addControlName

protected void addControlName(java.lang.String sName)
                       throws InvalidControlNameException
Adds a new control name to the form.
Parameters:
sName - the control name to add
Throws:
InvalidControlNameException - if the control name is not valid
See Also:
removeControlName(String)

removeControlName

protected void removeControlName(java.lang.String sName)
Removes a control name from the form. The control name can be used again by another object after it has been removed.
Parameters:
sName - the control name to remove
See Also:
addControlName(String)

setMethod

public void setMethod(java.lang.String sMethod)

Sets the submit method of this form. The 2 typical values are "post" and "get" (default).

The html attribute it sets is "method".

If null is specified the attribute is cleared.

Parameters:
sMethod - the method for this element
See Also:
HtmlElement.setAttribute(String, String), getMethod(), GET, POST

getMethod

public java.lang.String getMethod()
Returns the method of this object.
Returns:
the method for this element, null is returned if the attribute is not set
See Also:
setMethod(String), HtmlElement.getAttribute(String)

setName

public void setName(java.lang.String sName)

Sets the name of this form. The name is used in the client-side scripting code to reference this form.

The html attribute it sets is "name".

If null is specified the attribute is cleared.

Parameters:
sName - the name for this element
See Also:
HtmlElement.setAttribute(String, String), getName()

getName

public java.lang.String getName()
Returns the method of this object.
Returns:
the method for this element, null is returned if the attribute is not set
See Also:
setMethod(String), HtmlElement.getAttribute(String)

setAction

public void setAction(java.lang.String sAction)

Sets the action of this form. The action should be a URL, the server will use this to determine the action to be performed.

The html attribute it sets is "action".

If null is specified the attribute is cleared.

Parameters:
sName - the name for this element
See Also:
HtmlElement.setAttribute(String, String), getAction()

getAction

public java.lang.String getAction()
Returns the action of this object.
Returns:
the action for this element, null is returned if the attribute is not set
See Also:
setAction(String), HtmlElement.getAttribute(String)

updateData

public void updateData(javax.servlet.http.HttpServletRequest objRequest)
Updates all HtmlControlWidget objects with the data submitted from the client.
Parameters:
objRequest - the request object that contains the user submitted data
See Also:
HtmlControlWidget.updateData(HttpServletRequest), beforeUpdateData(HttpServletRequest), afterUpdateData(HttpServletRequest)

beforeUpdateData

public Signal beforeUpdateData(javax.servlet.http.HttpServletRequest objRequest)
This signal is emitted just before the updateData(HttpServletRequest) method updates all the form object with the submitted data.
Parameters:
objRequest - the request object that contains the user submitted data
Returns:
the signal
See Also:
updateData(HttpServletRequest)

afterUpdateData

public Signal afterUpdateData(javax.servlet.http.HttpServletRequest objRequest)
This signal is emitted just after the updateData(HttpServletRequest) method updates all the form object with the submitted data.
Parameters:
objRequest - the request object that contains the user submitted data
Returns:
the signal
See Also:
updateData(HttpServletRequest)