Class: AllValidator

sogv.AllValidator

Validates that a value is valid according to list of validation rules.

new sogv.AllValidator (data, rules, options)

Create a new Validator.

Name Type Description
data * The data which needs to be validated.
rules Object Validation rules.
options Object The setting options.
Properties:
Name Type Description
alias Array

The aliases for the current validator.

They could be used in the short validation format.

Defined aliases: ['all'].

options Object The description of the required options.
Example
var rules = 'required|email';
var data = 'iamtheslaveofgod@gmail.com'
var validator = new sogv.AllValidator(data, rules, {
     lang: 'en'
});
if (false === validator.isValid()) {
     validator.errors().first();
}

Extends

Members

data * inherited

Data that needs to be validated.

lang String inherited

Language of error messages.

rules String

Validation rules.

Methods

add (name, options)

Add new validator
Name Type Description
name String The validator name
options Object The validation settings

errors ()sogv.Error inherited

Return error errors

Returns:
Type Description
sogv.Error Error messages

isValid ()Boolean inherited overrides

Check if data valid.

Returns:
Type Description
Boolean Validation status