public class Validator extends Object
Usage is like so:
_validator.add(_username).requireNonEmpty("Please enter your username.");
_validator.add(_password).requireLengthOf(6, "Enter a password of at least 6 characters.");
_validator.add(_agreeTOS).requireChecked("Agreement with the Terms of Service is required.");
// ..before submitting form...
if (!_validator.validate(true)) // abort!
| Modifier and Type | Class and Description |
|---|---|
class |
Validator.CheckBoxValidator |
class |
Validator.IntegerBoxValidator |
static interface |
Validator.Rule
Checks a single validation condition.
|
class |
Validator.TextBoxValidator |
| Constructor and Description |
|---|
Validator() |
| Modifier and Type | Method and Description |
|---|---|
Validator.CheckBoxValidator |
add(CheckBox box) |
Validator.IntegerBoxValidator |
add(IntegerBox box) |
Validator.TextBoxValidator |
add(TextBox box)
Returns a validator that provides rules for text boxes.
|
boolean |
validate(boolean asError)
Executes all registered validators (in registration order).
|
public Validator.TextBoxValidator add(TextBox box)
public Validator.CheckBoxValidator add(CheckBox box)
public Validator.IntegerBoxValidator add(IntegerBox box)
public boolean validate(boolean asError)
Copyright © 2013. All Rights Reserved.