Validator Class
Validator class stores all constraints functions and associated messages. Provides public interface to add, remove or modify them
Constructor
Validator
()
Methods
addMessage
(
-
name
-
message
Add / override error message
Parameters:
-
name
StringMessage name. Will automatically be binded to validator with same name
-
message
StringMessage
addValidator
(
-
name
-
fn
Add / override a validator in validators list
Parameters:
-
name
StringValidator name. Will automatically bindable through data-name=''
-
fn
FunctionValidator function. Must return {Boolean}
formatMesssage
(
String
-
message
-
args
Replace %s placeholders by values
Parameters:
-
message
StringMessage key
-
args
MixedArgs passed by validators functions. Could be string, number or object
Returns:
String:
Formatted string
Properties
messages
Object
Error messages
validators
Object
Validator list. Built-in validators functions