nl.gx.webmanager.handler.forms.validation
Class AgeFormPartValidator
java.lang.Object
nl.gx.webmanager.handler.forms.validation.AgeFormPartValidator
- All Implemented Interfaces:
- FormComponent, Validator
public class AgeFormPartValidator
- extends java.lang.Object
- implements Validator
Checks whether someone or something is old/young enough according to a date.
| Variable |
Type |
Mode |
Default |
Description |
| wmformpart |
Parameter |
Required |
- |
The formpart to validate (eg. date of birth). |
| datepattern |
Parameter |
Required |
- |
Can be used to specify the format of 'wmformpart'. The default is locale specific. |
| maximum_age |
Parameter |
Required |
- |
Maximum age (in years). |
| minimum_age |
Parameter |
Required |
- |
Minimum age (in years). |
| illegaldate |
- |
- |
- |
If 'wmformpart' is not recognized as being a date. |
| tooyoung |
- |
- |
- |
If the number of years between 'wmformpart' and today is too small. |
| tooold |
- |
- |
- |
If the number of years between 'wmformpart' and today is too big. |
Example usage:
- Adult sales.
- Different subscription fees according to age.
|
Method Summary |
void |
init(FormComponentConfig c)
Passes the initialization parameters to the component. |
ValidatorMessage[] |
validate(FormDefinition form,
State formState,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Performs validation on a form and returns an array of validator
messages, containing errors detected in the submitted values. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ILLEGAL_DATE
public static final java.lang.String ILLEGAL_DATE
- See Also:
- Constant Field Values
TOO_YOUNG
public static final java.lang.String TOO_YOUNG
- See Also:
- Constant Field Values
TOO_OLD
public static final java.lang.String TOO_OLD
- See Also:
- Constant Field Values
AgeFormPartValidator
public AgeFormPartValidator()
init
public void init(FormComponentConfig c)
throws InitializationException
- Description copied from interface:
FormComponent
- Passes the initialization parameters to the component.
- Specified by:
init in interface FormComponent
- Parameters:
c - The FormComponentConfig object that contains
configutation information for this component.
- Throws:
InitializationException - If initialization failed
validate
public ValidatorMessage[] validate(FormDefinition form,
State formState,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
- Description copied from interface:
Validator
- Performs validation on a form and returns an array of validator
messages, containing errors detected in the submitted values.
- Specified by:
validate in interface Validator
- Parameters:
form - The form that should be validatedformState - The object representing the state of the formflow.
This object provides access to values submitted by the client and
the exceptions and validator messages for the form.req - The http servlet requestres - The http servlet response
- Returns:
- The array of validator messages, containing validation errors for the form.
Copyright © 2007-2011 GX Software BV. All Rights Reserved.