Class M.Validator
Extends
M.Object.
The prototype for every validator. All validation logic is implemented in the specific validators.
Defined in: validator.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
The type of this object.
|
|
"Class-wide" array containing error objects.
|
Method Attributes | Method Name and Description |
---|---|
Empties the error buffer, is done before each new validation process
|
|
customize(obj)
extends this.
|
Field Detail
{String}
type
The type of this object.
{Array|Object}
validationErrors
"Class-wide" array containing error objects.
Specific validators do NOT have an own validationErrors array, but use this one to write errors to.
Error object represent errors that occured during validation.
E.g. error object:
{
msg: 'E-Mail adress not valid.',
modelId: 'Task_123',
property: 'email',
viewId: 'm_123',
validator: 'EMAIL',
onSuccess: function(){proceed();}
onError: function(markTextFieldError(); console.log('email not valid')};
}
Method Detail
clearErrorBuffer()
Empties the error buffer, is done before each new validation process
{Object}
customize(obj)
extends this.
Can be used to provide a custom error msg to a validator
E.g.
M.EmailValidator.customize({msg: 'Please provide a valid e-mail adress.'});
- Parameters:
- obj
- Returns:
- {Object} The customized validator.