com.primix.tapestry.valid
Class ValidatingTextField
java.lang.Object
|
+--com.primix.tapestry.AbstractComponent
|
+--com.primix.tapestry.form.AbstractFormComponent
|
+--com.primix.tapestry.form.AbstractTextField
|
+--com.primix.tapestry.valid.AbstractValidatingTextField
|
+--com.primix.tapestry.valid.ValidatingTextField
- All Implemented Interfaces:
- java.util.EventListener, IComponent, IFormComponent, IRender, IValidatingTextField, PageDetachListener
- public class ValidatingTextField
- extends AbstractValidatingTextField
A Form
component that can be used to
create a text field that validates that the user
has entered a value (if required) and that the
value has a known minimum length.
When the form is submitted, the result is filtered: If it fails
validation, then no update (through the text binding) is performed. Instead,
an error flag is set. Also, the invalid text is kept so that it can
be the default value for the form element when the page is rendered.
Doesn't work inside a Foreach
... it maintains a little bit
of state (invalid text, error flag)
that will get confused if the component is re-used on the page.
Parameter |
Type |
Read / Write |
Required |
Default |
Description |
text |
java.lang.String |
R / W |
yes |
|
The text inside the text field. This value will only be
read once per request cycle (don't use a ValidatingTextField inside
a Foreach ).
When the form is submitted, the binding is only updated if the value
is valid. |
minimumLength |
int |
R |
no |
0 |
The minimum length (number of characters read) for the field. The
value provided in the request is trimmed of leading and trailing whitespace.
If a field is not required and no value is given, then minimumLength is ignored.
Minimum length only applies if some non-null value is given. |
required |
boolean |
R |
no |
false |
If true, then a non-null value must be provided. A value consisting
only of whitespace is considered null. |
displayName |
String |
R |
yes |
|
A textual name for the field that is used when formulating error messages.
|
delegate |
IValidationDelegate |
R |
yes |
|
Object used to assist in error reporting. |
May not have a body. May have informal parameters,
which are applied to the underlying TextField
.
- Version:
- $Id: ValidatingTextField.java,v 1.6 2001/08/26 04:53:58 hship Exp $
- Author:
- Howard Ship
Methods inherited from class com.primix.tapestry.valid.AbstractValidatingTextField |
beforeCloseTag, finishLoad, getDelegate, getDelegateBinding, getDisplayName, getDisplayNameBinding, getError, getRequiredBinding, getString, getString, getString, isRequired, notifyDelegate, pageDetached, readValue, refresh, render, setDelegateBinding, setDisplayNameBinding, setError, setRequiredBinding, updateValue |
Methods inherited from class com.primix.tapestry.AbstractComponent |
addAsset, addComponent, addWrapped, cleanupAfterRender, cleanupComponent, finishLoad, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, generateAttributes, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getChangeObserver, getComponent, getComponents, getContainer, getExtendedId, getId, getIdPath, getListeners, getPage, getSpecification, prepareForRender, renderWrapped, reset, setBinding, setContainer, setId, setPage, setSpecification, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.primix.tapestry.IComponent |
addAsset, addComponent, addWrapped, finishLoad, getAsset, getAssets, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainer, getExtendedId, getId, getIdPath, getPage, getSpecification, renderWrapped, setBinding, setContainer, setId, setPage, setSpecification |
ValidatingTextField
public ValidatingTextField()
getTextBinding
public IBinding getTextBinding()
setTextBinding
public void setTextBinding(IBinding value)
getMinimumLengthBinding
public IBinding getMinimumLengthBinding()
setMinimumLengthBinding
public void setMinimumLengthBinding(IBinding value)
read
protected java.lang.String read()
- Reads the current value of the text parameter.
- Overrides:
read
in class AbstractValidatingTextField
update
protected void update(java.lang.String value)
- Description copied from class:
AbstractValidatingTextField
- Invoked from
AbstractValidatingTextField.updateValue(String)
to validate that the new value
(submitted in the form by the user) conforms to the rules for
this component. If not, it should invoke
AbstractValidatingTextField.notifyDelegate(ValidationConstraint, String)
.
If the value is acceptible, then the component should update
through its parameter (this is very component specific).
- Overrides:
update
in class AbstractValidatingTextField