Class WStackedValidator
This validator allows you to combine multiple validators into a single one.
For a value to be considered valid by this validator, it must be valid for all of the validators added to it. In case the value is invalid for multiple validators, the validator used to generate the error message is the one with the lowest index.
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WValidator
WValidator.Result -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddValidator(WValidator validator) Adds a validator.voidclear()Removes all the validators.Creates a Javascript object that validates the input.intgetSize()Returns the number of validators.voidinsertValidator(int index, WValidator validator) Inserts a validator to the given index.voidremoveValidator(WValidator validator) Removes the given validator.Validates the given input.Methods inherited from class eu.webtoolkit.jwt.WValidator
getFormat, getInputFilter, getInvalidBlankText, isMandatory, setInvalidBlankText, setMandatory
-
Constructor Details
-
WStackedValidator
public WStackedValidator()Creates an empty stacked validator.
-
-
Method Details
-
addValidator
Adds a validator.This adds a validator at the last index if the validator is not already present in the list of validators.
-
insertValidator
Inserts a validator to the given index.This inserts a validator at the given index, or at last index if the given index is bigger than the number of validators. Does nothing if the validator is already present in the list of validators.
-
removeValidator
Removes the given validator. -
getSize
public int getSize()Returns the number of validators. -
clear
public void clear()Removes all the validators. -
validate
Description copied from class:WValidatorValidates the given input.Note: The signature for this method changed in JWt 3.2.0.
- Overrides:
validatein classWValidator
-
getJavaScriptValidate
Description copied from class:WValidatorCreates a Javascript object that validates the input.The JavaScript expression should evaluate to an object which contains a
validate(text)function, which returns an object that contains the following two fields:- fields: a boolean valid,
- a
messagethat indicates the problem if not valid.
Returns an empty string if the validator does not provide a client-side validation implementationq.
- Overrides:
getJavaScriptValidatein classWValidator- See Also:
-