Class: Validations

mvcomponents/core. Validations

classe auxiliar para validacao de campos


new Validations()

Methods


<static> email(v)

Valida um email

Parameters:
Name Type Description
v string
Returns:
Type
Validation.<string>

<static> greaterThan(v)

Maior que

Parameters:
Name Type Description
v number
Example
myInput.validator.add(Validations.greaterThan(5));
myInput.setValue(10);
myInput.validate().then(()=>console.log('ok'));

<static> lessThan(v)

Menor que

Parameters:
Name Type Description
v number
Example
myInput.validator.add(Validations.lessThan(5));
myInput.setValue(10);
myInput.validate().then(()=>console.log('ok'));

<static> maxLength(v)

Tamanho maximo

Parameters:
Name Type Description
v number
Example
myInput.validator.add(Validations.maxLength(2));
myInput.setValue('aa');
myInput.validate().then(()=>console.log('ok'));

<static> minLength(v)

Tamanho minino

Parameters:
Name Type Description
v number
Example
myInput.validator.add(Validations.minLength(2));
myInput.setValue('aa');
myInput.validate().then(()=>console.log('ok'));

<static> regexp(regexp)

Expressao regular

Parameters:
Name Type Description
regexp RegExp
Example
myInput.validator.add(Validations.regexp(/teste/g));
myInput.setValue('teste');
myInput.validate().then(()=>console.log('ok'));