org.apache.click.control
Class Field

java.lang.Object
  extended by org.apache.click.control.AbstractControl
      extended by org.apache.click.control.Field
All Implemented Interfaces:
Serializable, Control, Stateful
Direct Known Subclasses:
Button, Checkbox, FieldSet, FileField, HiddenField, Label, Radio, RadioGroup, Select, TextArea, TextField

public abstract class Field
extends AbstractControl
implements Stateful

Provides an abstract form Field control. Field controls are contained by the Form control which will orchestrate the processing and rendering of the contained fields. All Form field controls must extend this abstract class.

Field Processing

Post Requests

When processing POST requests forms typically invoke the onProcess() method on all its fields. The Field onProcess() method is used to bind the fields request value, validate the submission and invoke any control listener method. If the onProcess() method returns true the form will continue processing fields, otherwise the form will abort further processing.

The body of the Field onProcess() method is detailed below.

 public boolean onProcess() {
     bindRequestValue();

     if (getValidate()) {
         validate();
     }

     registerActionEvent();

     return true;
 } 
The Field methods called by onProcess() include:
bindRequestValue()
This method will bind the HTTP request value to the Field's value.
getValidate()
This method will return true if the Field should validate itself. This value is generally inherited from the parent Form, however the Field can override this value and specify whether it should be validated.
validate()
This method will validate the submitted Field value. If the submitted value is not valid this method should set the Field error property, which can be rendered by the Form.
AbstractControl.dispatchActionEvent()
This method will register any Control action listener method which has be defined for the Field.
Field subclasses generally only have to override the validate() method, and possibly the bindRequestValue() method, to provide their own behaviour.

Get Requests

When processing GET requests a Page's Form will typically perform no processing and simply render itself and its Fields.

Rendering

Field subclasses must override the AbstractControl.render(org.apache.click.util.HtmlStringBuffer) method to enable themselves to be rendered as HTML. With the increasing use of AJAX, Fields should render themselves as valid XHTML, so that they may be parsed correctly and used as the innerHtml in the DOM.

When a Form object renders a Field using autolayout, it renders the Field in a table row using the Field's label attribute, its error attribute if defined, and the Fields AbstractControl.render(org.apache.click.util.HtmlStringBuffer) method.

To assist with rendering valid HTML Field subclasses can use the HtmlStringBuffer class.

Message Resources and Internationalization (i18n)

Fields support a hierarchy of resource bundles for displaying validation error messages and display messages. These localized messages can be accessed through the methods: Fields automatically pick up localized messages where applicable. Please see the following methods on how to customize these messages: The order in which localized messages resolve are:
Page scope messages
Message lookups are first resolved to the Pages message bundle if it exists. For example a Login page may define the message properties:
 /com/mycorp/page/Login.properties 
If you want messages to be used only for a specific Page, this is where to place them.
Global page scope messages
Next message lookups are resolved to the global pages message bundle if it exists.
 /click-page.properties 
If you want messages to be used across your entire application this is where to place them.
Control scope messages
Next message lookups are resolved to the Control message bundle if it exists. For example a CustomTextField control may define the message properties:
 /com/mycorp/control/CustomTextField.properties 
Global control scope messages
Finally message lookups are resolved to the global application control message bundle if the message has not already found. The global control properties file is:
 /click-control.properties 
You can modify these properties by copying this file into your applications root class path and editing these properties.

Note when customizing the message properties you must include all the properties, not just the ones you want to override.

See Also:
Serialized Form

Field Summary
protected  boolean disabled
          The Field disabled value.
protected  String error
          The Field error message.
protected  boolean focus
          The request focus flag.
protected  Form form
          The parent Form.
protected  String help
          The Field help text.
protected  String label
          The Field label.
protected  String labelStyle
          The field label "style" attribute value.
protected  String labelStyleClass
          The field label "class" attribute value.
protected  String parentStyleClassHint
          The field's parent element "class" attribute hint.
protected  String parentStyleHint
          The field's parent element "style" attribute hint.
protected  boolean readonly
          The Field is readonly flag.
protected  boolean required
          The Field is required flag.
protected  int tabindex
          The Field 'tabindex' attribute.
protected  String title
          The Field 'title' attribute, which acts as a tooltip help message.
protected  boolean trim
          The Field is trimmed flag, default value is true.
protected  Boolean validate
          The validate Field value onProcess() invocation flag.
protected  String value
          The Field value.
 
Fields inherited from class org.apache.click.control.AbstractControl
actionListener, attributes, behaviors, headElements, listener, listenerMethod, messages, name, parent, styles
 
Fields inherited from interface org.apache.click.Control
CONTROL_MESSAGES
 
Constructor Summary
Field()
          Construct a new Field object.
Field(String name)
          Construct the Field with the given name.
Field(String name, String label)
          Construct the Field with the given name and label.
 
Method Summary
 void bindRequestValue()
          This method binds the submitted request value to the Field's value.
 String getError()
          Return the validation error message if the Field is not valid, or null if valid.
protected  String getErrorLabel()
          Return a normalized label for display in error messages.
 boolean getFocus()
          Return true if the field has requested focus.
 String getFocusJavaScript()
          Return the Field focus JavaScript.
 Form getForm()
          Return the parent Form containing the Field or null if no form is present in the parent hierarchy.
 String getHelp()
          Return the field help text.
 String getId()
          Return the Form and Field id appended:   "form-field"

Use the field the "id" attribute value if defined, or the name otherwise.

 String getLabel()
          Return the field display label.
 String getLabelStyle()
          Return the field label "style" attribute value.
 String getLabelStyleClass()
          Return the field label "class" attribute value.
 String getParentStyleClassHint()
          Return the field's parent "class" attribute hint.
 String getParentStyleHint()
          Return the field's parent "style" attribute hint.
protected  String getRequestValue()
          Return the field's value from the request.
 Object getState()
          Return the Field state.
 int getTabIndex()
          Return the field "tabindex" attribute value.
 String getTextAlign()
          Return the field CSS "text-align" style, or null if not defined.
 String getTitle()
          Return the 'title' attribute, or null if not defined.
 boolean getValidate()
          Return true if the Field should validate itself when being processed.
 String getValidationJavaScript()
          Return the field JavaScript client side validation function.
 String getValue()
          Return the Field value.
 Object getValueObject()
          Return the object representation of the Field value.
 String getWidth()
          Return the width CSS "width" style, or null if not defined.
 boolean isDisabled()
          Return true if the Field is disabled.
 boolean isHidden()
          Return true if the Field type is hidden (<input type="hidden"/>) or false otherwise.
 boolean isReadonly()
          Return true if the Field is a readonly.
 boolean isRequired()
          Return true if the Field's value is required.
 boolean isTrim()
          Return true if the Field request value should be trimmed, false otherwise.
 boolean isValid()
          Return true if the Field is valid after being processed, or false otherwise.
 boolean onProcess()
          This method processes the page request returning true to continue processing or false otherwise.
 void removeState(Context context)
          Remove the Field state from the session for the given request context.
protected  void renderTagBegin(String tagName, HtmlStringBuffer buffer)
          Render the Field tag and common attributes including name, id, class and style.
 void restoreState(Context context)
          Restore the Field state from the session for the given request context.
 void saveState(Context context)
          Save the Field state to the session for the given request context.
 void setDisabled(boolean disabled)
          Set the Field disabled flag.
 void setError(String error)
          Set the Field validation error message.
protected  void setErrorMessage(String key)
          Set the error with the a label formatted message specified by the given message bundle key.
protected
<T> void
setErrorMessage(String key, T value)
          Set the error with the a label and value formatted message specified by the given message bundle key.
 void setFocus(boolean focus)
          Set the Field request focus flag.
 void setForm(Form form)
          Set the Field's the parent Form.
 void setHelp(String help)
          Set the Field help text.
 void setLabel(String label)
          Set the Field display caption.
 void setLabelStyle(String value)
          Set the field label "style" attribute value.
 void setLabelStyleClass(String value)
          Set the field label "class" attribute value.
 void setListener(Object listener, String method)
          The callback listener will only be called during processing if the Field value is valid.
 void setParent(Object parent)
          Set the parent of the Field.
 void setParentStyleClassHint(String styleClassHint)
          Set the field's parent "class" attribute hint.
 void setParentStyleHint(String styleHint)
          Set the field's parent "style" attribute hint.
 void setReadonly(boolean readonly)
          Set the Field readonly flag.
 void setRequired(boolean required)
          Set the Field required status.
 void setState(Object state)
          Set the Field state.
 void setTabIndex(int tabindex)
          Set the field "tabindex" attribute value.
 void setTextAlign(String align)
          Set the field CSS horizontal "text-align" style.
 void setTitle(String value)
          Set the 'title' attribute tooltip message.
 void setTrim(boolean trim)
          Set the trim flag to true if the Field request value should be trimmed, false otherwise.
 void setValidate(boolean validate)
          Set the validate Field value when being processed flag.
 void setValue(String value)
          Set the Field value.
 void setValueObject(Object object)
          Set the value of the field using the given object.
 void setWidth(String value)
          Set the the CSS "width" style attribute.
 void validate()
          The validate method is invoked by onProcess() to validate the request submission.
 
Methods inherited from class org.apache.click.control.AbstractControl
addBehavior, addStyleClass, appendAttributes, dispatchActionEvent, getActionListener, getAttribute, getAttributes, getBehaviors, getContext, getControlSizeEst, getHeadElements, getHtmlImports, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, getTag, hasAttribute, hasAttributes, hasBehaviors, hasStyles, isAjaxTarget, onDeploy, onDestroy, onInit, onRender, removeBehavior, removeStyleClass, render, renderTagEnd, setActionListener, setAttribute, setId, setName, setStyle, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

disabled

protected boolean disabled
The Field disabled value.


error

protected String error
The Field error message.


focus

protected boolean focus
The request focus flag.


form

protected Form form
The parent Form.


help

protected String help
The Field help text.


label

protected String label
The Field label.


labelStyle

protected String labelStyle
The field label "style" attribute value.


labelStyleClass

protected String labelStyleClass
The field label "class" attribute value.


parentStyleHint

protected String parentStyleHint
The field's parent element "style" attribute hint.


parentStyleClassHint

protected String parentStyleClassHint
The field's parent element "class" attribute hint.


readonly

protected boolean readonly
The Field is readonly flag.


required

protected boolean required
The Field is required flag.


tabindex

protected int tabindex
The Field 'tabindex' attribute.


title

protected String title
The Field 'title' attribute, which acts as a tooltip help message.


trim

protected boolean trim
The Field is trimmed flag, default value is true.


validate

protected Boolean validate
The validate Field value onProcess() invocation flag.


value

protected String value
The Field value.

Constructor Detail

Field

public Field()
Construct a new Field object.


Field

public Field(String name)
Construct the Field with the given name.

Parameters:
name - the name of the Field

Field

public Field(String name,
             String label)
Construct the Field with the given name and label.

Parameters:
name - the name of the Field
label - the label of the Field
Method Detail

setParent

public void setParent(Object parent)
Set the parent of the Field.

Specified by:
setParent in interface Control
Overrides:
setParent in class AbstractControl
Parameters:
parent - the parent of the Control
Throws:
IllegalStateException - if AbstractControl.name is not defined
IllegalArgumentException - if the given parent instance is referencing this object: if (parent == this)
See Also:
Control.setParent(Object)

isDisabled

public boolean isDisabled()
Return true if the Field is disabled. The Field will also be disabled if the parent FieldSet or Form is disabled.

Returns:
true if the Field is disabled
See Also:
setDisabled(boolean)

setDisabled

public void setDisabled(boolean disabled)
Set the Field disabled flag. Disabled fields are not processed nor validated and their action event is not fired.

Important Note: an HTML form POST does not submit disabled fields values. Similarly disabled Click fields do not get processed or validated. However, JavaScript is often used to enable fields prior to submission. Click is smart enough to recognize when a field was enabled this way by checking if the field has an incoming request parameter. If a field is disabled but has an incoming request parameter, Click will "enable" the field and process it.

Caveat: Unfortunately the above behavior does not apply to Checkbox and Radio buttons. An HTML form POST for a disabled checkbox/radio is the same as for an unchecked checkbox/radio. In neither case is a value submitted to the server and Click cannot make the distinction whether the checkbox/radio is disabled or unchecked.

Parameters:
disabled - the Field disabled flag

getError

public String getError()
Return the validation error message if the Field is not valid, or null if valid.

Returns:
the Field validation error message, or null if valid

setError

public void setError(String error)
Set the Field validation error message. If the error message is not null the Field is invalid, otherwise it is valid.

Parameters:
error - the validation error message

getFocus

public boolean getFocus()
Return true if the field has requested focus.

Returns:
true if the field has requested focus

setFocus

public void setFocus(boolean focus)
Set the Field request focus flag.

Parameters:
focus - the request focus flag

getFocusJavaScript

public String getFocusJavaScript()
Return the Field focus JavaScript.

Returns:
the Field focus JavaScript

getForm

public Form getForm()
Return the parent Form containing the Field or null if no form is present in the parent hierarchy.

Returns:
the parent Form containing the Field

setForm

public void setForm(Form form)
Set the Field's the parent Form.

Parameters:
form - Field's parent Form

getHelp

public String getHelp()
Return the field help text.

If the help value is null, this method will attempt to find a localized help message in the parent messages using the key:

getName() + ".help"
If not found then the message will be looked up in the /click-control.properties file using the same key.

For example given a CustomerPage with the properties file CustomerPage.properties:

 name.label=Customer Name
 name.help=Full name or Business name 
The page TextField code:
 public class CustomerPage extends Page {
     TextField nameField = new TextField("name");
     ..
 } 
Will render the TextField label and title properties as:
 <td><label>Customer Name</label></td>
 <td><input type="text" name="name"/> <span="Full name or Business name"/>/td> 
How the help text is rendered is depends upon the Field subclass.

Returns:
the help text of the Field

setHelp

public void setHelp(String help)
Set the Field help text.

Parameters:
help - the help text of the Field

isHidden

public boolean isHidden()
Return true if the Field type is hidden (<input type="hidden"/>) or false otherwise. By default this method returns false.

Returns:
false

getId

public String getId()
Return the Form and Field id appended:   "form-field"

Use the field the "id" attribute value if defined, or the name otherwise.

Specified by:
getId in interface Control
Overrides:
getId in class AbstractControl
Returns:
HTML element identifier attribute "id" value
See Also:
Control.getId()

getLabel

public String getLabel()
Return the field display label.

If the label value is null, this method will attempt to find a localized label message in the parent messages using the key:

getName() + ".label"
If not found then the message will be looked up in the /click-control.properties file using the same key. If a value is still not found, the Field name will be converted into a label using the method: ClickUtils.toLabel(String)

For example given a CustomerPage with the properties file CustomerPage.properties:

 name.label=Customer Name
 name.title=Full name or Business name 
The page TextField code:
 public class CustomerPage extends Page {
     TextField nameField = new TextField("name");
     ..
 } 
Will render the TextField label and title properties as:
 <td><label>Customer Name</label></td>
 <td><input type="text" name="name" title="Full name or Business name"/></td> 
When a label value is not set, or defined in any properties files, then its value will be created from the Fields name.

For example given the TextField code:

 TextField nameField = new TextField("faxNumber");  
Will render the TextField label as:
 <td><label>Fax Number</label></td>
 <td><input type="text" name="faxNumber"/></td> 

Returns:
the display label of the Field

setLabel

public void setLabel(String label)
Set the Field display caption.

Parameters:
label - the display label of the Field

getLabelStyle

public String getLabelStyle()
Return the field label "style" attribute value.

Returns:
the field label "style" attribute value
See Also:
setLabelStyle(java.lang.String)

setLabelStyle

public void setLabelStyle(String value)
Set the field label "style" attribute value.

Please note: the label is rendered by the containing Form or container, not the field itself. It is up to the parent Form (or container) on how to apply the label style.

 nameField.setLabelStyle("color: green; font-weight: bold");

Parameters:
value - the field label "style" attribute value

getLabelStyleClass

public String getLabelStyleClass()
Return the field label "class" attribute value.

Returns:
the field label "class" attribute value
See Also:
setLabelStyleClass(java.lang.String)

setLabelStyleClass

public void setLabelStyleClass(String value)
Set the field label "class" attribute value.

Please note: the label is rendered by the containing Form or container, not the field itself. It is up to the parent Form (or container) on how to apply the label style class.

Parameters:
value - the field label "class" attribute value

getParentStyleHint

public String getParentStyleHint()
Return the field's parent "style" attribute hint.

Returns:
the field's parent "style" attribute hint
See Also:
setParentStyleHint(java.lang.String)

setParentStyleHint

public void setParentStyleHint(String styleHint)
Set the field's parent "style" attribute hint.

 nameField.setParentStyleHint("margin-bottom; 10px");
Please note:The field's parent style provides a hint to Forms (or other containers) what style to render, but it is up to the Form (or container) implementation how the style will be applied. For example, Form will render the parent style on the table cells containing the field and label.

Parameters:
styleHint - the field's parent "style" attribute hint

getParentStyleClassHint

public String getParentStyleClassHint()
Return the field's parent "class" attribute hint.

Returns:
the field's parent "class" attribute hint
See Also:
setParentStyleClassHint(java.lang.String)

setParentStyleClassHint

public void setParentStyleClassHint(String styleClassHint)
Set the field's parent "class" attribute hint.

Please note:The parent style class provides a hint to Forms (or other containers) which CSS class to render, but it is up to the Form (or container) implementation how the style class will be applied. For example, Form will render the parent style class on the table cells containing the field and label.

Parameters:
styleClassHint - the field parent "class" attribute hint

setListener

public void setListener(Object listener,
                        String method)
The callback listener will only be called during processing if the Field value is valid. If the field has validation errors the listener will not be called.

Specified by:
setListener in interface Control
Overrides:
setListener in class AbstractControl
Parameters:
listener - the listener object with the named method to invoke
method - the name of the method to invoke
See Also:
Control.getName()

isReadonly

public boolean isReadonly()
Return true if the Field is a readonly. The Field will also be readonly if the parent FieldSet or Form is readonly.

Returns:
true if the Field is a readonly

setReadonly

public void setReadonly(boolean readonly)
Set the Field readonly flag.

Parameters:
readonly - the Field readonly flag

isRequired

public boolean isRequired()
Return true if the Field's value is required.

Returns:
true if the Field's value is required

setRequired

public void setRequired(boolean required)
Set the Field required status.

Parameters:
required - set the Field required status

getTabIndex

public int getTabIndex()
Return the field "tabindex" attribute value.

Returns:
the field "tabindex" attribute value

setTabIndex

public void setTabIndex(int tabindex)
Set the field "tabindex" attribute value.

Parameters:
tabindex - the field "tabindex" attribute value

getTextAlign

public String getTextAlign()
Return the field CSS "text-align" style, or null if not defined.

Returns:
the field CSS "text-align" style, or null if not defined.

setTextAlign

public void setTextAlign(String align)
Set the field CSS horizontal "text-align" style.

Parameters:
align - the CSS "text-align" value: ["left", "right", "center"]

getTitle

public String getTitle()
Return the 'title' attribute, or null if not defined. The title attribute acts like tooltip message over the Field.

If the title value is null, this method will attempt to find a localized title message in the parent messages using the key:

getName() + ".title"
If not found then the message will be looked up in the /click-control.properties file using the same key. If still not found the title will be left as null and will not be rendered.

For example given a CustomerPage with the properties file CustomerPage.properties:

 name.label=Customer Name
 name.title=Full name or Business name 
The page TextField code:
 public class CustomerPage extends Page {
     TextField nameField = new TextField("name");
     ..
 } 
Will render the TextField label and title properties as:
 <td><label>Customer Name</label></td>
 <td><input type="text" name="name" title="Full name or Business name"/></td> 

Returns:
the 'title' attribute tooltip message

setTitle

public void setTitle(String value)
Set the 'title' attribute tooltip message.

Parameters:
value - the 'title' attribute tooltip message

isTrim

public boolean isTrim()
Return true if the Field request value should be trimmed, false otherwise. The default value is "true".

Returns:
true if the Field request value should be trimmed, false otherwise

setTrim

public void setTrim(boolean trim)
Set the trim flag to true if the Field request value should be trimmed, false otherwise.

Parameters:
trim - true if the Field request value should be trimmed, false otherwise

getValidate

public boolean getValidate()
Return true if the Field should validate itself when being processed.

If the validate attribute for the Field is not explicitly set, this method will return the validation status of its parent Form, see Form.getValidate(). If the Field validate attribute is not set and the parent Form is not set this method will return true.

This method is called by the onProcess() method to determine whether the the Field validate() method should be invoked.

Returns:
true if the Field should validate itself when being processed.

setValidate

public void setValidate(boolean validate)
Set the validate Field value when being processed flag.

Parameters:
validate - the field value when processed

getValidationJavaScript

public String getValidationJavaScript()
Return the field JavaScript client side validation function.

The function name must follow the format validate_[id], where the id is the DOM element id of the fields focusable HTML element, to ensure the function has a unique name.

Returns:
the field JavaScript client side validation function

isValid

public boolean isValid()
Return true if the Field is valid after being processed, or false otherwise. If the Field has no error message after Control.onProcess() has been invoked it is considered to be valid.

Returns:
true if the Field is valid after being processed

getValue

public String getValue()
Return the Field value.

Returns:
the Field value

setValue

public void setValue(String value)
Set the Field value.

Parameters:
value - the Field value

getValueObject

public Object getValueObject()
Return the object representation of the Field value. This method will return a string value, or null if the string value is null or is zero length.

Specialized object field subclasses should override this method to return a non string object. For examples a DoubleField would return a Double value instead.

Returns:
the object representation of the Field value

setValueObject

public void setValueObject(Object object)
Set the value of the field using the given object.

Parameters:
object - the object value to set

getWidth

public String getWidth()
Return the width CSS "width" style, or null if not defined.

Returns:
the CSS "width" style attribute, or null if not defined

setWidth

public void setWidth(String value)
Set the the CSS "width" style attribute.

Parameters:
value - the CSS "width" style attribute

bindRequestValue

public void bindRequestValue()
This method binds the submitted request value to the Field's value.

Please note: while it is possible to explicitly bind the field value by invoking this method directly, it is recommended to use the "bind" utility methods in ClickUtils instead. See ClickUtils.bind(org.apache.click.control.Field) for more details.


getState

public Object getState()
Return the Field state. The following state is returned:

Specified by:
getState in interface Stateful
Returns:
the Field state

setState

public void setState(Object state)
Set the Field state.

Specified by:
setState in interface Stateful
Parameters:
state - the Field state to set

onProcess

public boolean onProcess()
This method processes the page request returning true to continue processing or false otherwise. The Field onProcess() method is typically invoked by the Form onProcess() method when processing POST request.

This method will bind the Field request parameter value to the field, validate the submission and invoke its callback listener if defined.

Below is a typical onProcess implementation:

 public boolean onProcess() {
     bindRequestValue();

     if (getValidate()) {
         validate();
     }

     registerActionEvent();

     return true
 } 

Specified by:
onProcess in interface Control
Overrides:
onProcess in class AbstractControl
Returns:
true to continue Page event processing or false otherwise
See Also:
Control.onProcess()

removeState

public void removeState(Context context)
Remove the Field state from the session for the given request context.

Parameters:
context - the request context
See Also:
saveState(org.apache.click.Context), restoreState(org.apache.click.Context)

restoreState

public void restoreState(Context context)
Restore the Field state from the session for the given request context.

This method delegates to setState(java.lang.Object) to set the field restored state.

Parameters:
context - the request context
See Also:
saveState(org.apache.click.Context), removeState(org.apache.click.Context)

saveState

public void saveState(Context context)
Save the Field state to the session for the given request context.

* This method delegates to getState() to retrieve the field state to save.

Parameters:
context - the request context
See Also:
restoreState(org.apache.click.Context), removeState(org.apache.click.Context)

validate

public void validate()
The validate method is invoked by onProcess() to validate the request submission. Field subclasses should override this method to implement request validation logic.

If the field determines that the submission is invalid it should set the error property with the error message.


getErrorLabel

protected String getErrorLabel()
Return a normalized label for display in error messages.

The error label is a normalized version of getLabel().

Returns:
a normalized label for error message display

setErrorMessage

protected void setErrorMessage(String key)
Set the error with the a label formatted message specified by the given message bundle key. The message will be formatted with the field label using getErrorLabel().

setErrorMessage will attempt to find a localized error message as described here, using the following lookup strategy:

Parameters:
key - the key of the localized message bundle string

setErrorMessage

protected <T> void setErrorMessage(String key,
                                   T value)
Set the error with the a label and value formatted message specified by the given message bundle key. The message will be formatted with the field label {0} using getErrorLabel() and the given value {1}.

Also see setErrorMessage(java.lang.String) on how to specify error messages for specific Field instances.

Parameters:
key - the key of the localized message bundle string
value - the value to format in the message

getRequestValue

protected String getRequestValue()
Return the field's value from the request.

Returns:
the field's value from the request

renderTagBegin

protected void renderTagBegin(String tagName,
                              HtmlStringBuffer buffer)
Render the Field tag and common attributes including name, id, class and style.

Overrides:
renderTagBegin in class AbstractControl
Parameters:
tagName - the name of the tag to render
buffer - the buffer to append the output to
See Also:
AbstractControl.renderTagBegin(java.lang.String, org.apache.click.util.HtmlStringBuffer)