Class M.PresenceValidator
Extends
M.Validator.
Validates if value is existing. Used, e.g. for every property in a model record that is marked as 'required' (M.Model#isRequired.
Defined in: presence_validator.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
The type of this object.
|
- Fields borrowed from class M.Validator:
- validationErrors
Method Attributes | Method Name and Description |
---|---|
validate(obj, key)
Validation method.
|
- Methods borrowed from class M.Validator:
- clearErrorBuffer, customize
- Methods borrowed from class M.Object:
- bindToCaller, create, destroy, extend, get, include, set
Field Detail
{String}
type
The type of this object.
Method Detail
{Boolean}
validate(obj, key)
Validation method. First checks if value is not null, undefined or an empty string and then tries to create a M.Date with it.
Pushes different validation errors depending on where the validator is used: in the view or in the model.
- Parameters:
- {Object} obj
- Parameter object. Contains the value to be validated, the M.ModelAttribute object of the property and the model record's id.
- {String} key
- Returns:
- {Boolean} Indicating whether validation passed (YES|true) or not (NO|false).