org.jscience.sociology.forms
Class FormElement

java.lang.Object
  extended by org.jscience.sociology.forms.FormElement
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ChoiceBox, TextBox

public abstract class FormElement
extends java.lang.Object
implements java.io.Serializable

This abstract class is the superclass of all classes that represent form data input elements.

See Also:
TextBox, PasswordBox, ChoiceBox, MultipleChoiceBox, MenuBox, RadioButton, CheckBox, Serialized Form

Constructor Summary
FormElement()
           
 
Method Summary
 java.lang.String getErrorMessage()
          Gets the error message generated by this object.
 java.lang.String getName()
          Gets the name of this element.
 java.lang.String getValue()
          Gets the value of this element.
 void setValue(java.lang.String value)
          Sets the initial value of this element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormElement

public FormElement()
Method Detail

setValue

public void setValue(java.lang.String value)
Sets the initial value of this element. By default this value is set to an empty string. In forms.xml you set the initial field value like this:

 <field name="field name"
  type="org.jscience.sociology.forms.TextBox">
  <field-value>thevalue</field-value>
   ...............
   ...............
 </field>
 

The subclass MultipleChoiceBox overrides this method.

Parameters:
value - the initial value for this element.

getName

public java.lang.String getName()
Gets the name of this element. This is also the name of the corresponding request parameter. The built-in JSP-Bean presentation solution bounds this FormElement object to the HttpSession, using this name as a key.

See the source code of org.jscience.sociology.forms.util.SimpleContentGenerator.

Returns:
the name of this FormElement object.

getValue

public java.lang.String getValue()
Gets the value of this element. Subclasses of MultipleChoiceBox can have more than one value and in this case this method will return the value that was set last.

Returns:
the value.

getErrorMessage

public java.lang.String getErrorMessage()
Gets the error message generated by this object. This error message shows what was wrong with the last client entry.

Returns:
the error message.