Clear Up
SharpKit Reference

validations Class

Namespace: Ext.data

Base Types

System.Object

Constructors

Name Description
validations()

Methods

Name Description
email(object, JsString) Validates that an email string is in the correct format @param {Object} config Config object @param {String} email The email address @return {Boolean} True if the value passes validation
exclusion(object, JsString) Validates that the given value is present in the configured `list`. For example: * validations: [{type: 'exclusion', field: 'username', list: ['Admin', 'Operator']}] * @param {Object} config Config object @param {String} value The value to validate @return {Boolean} True if the value is not present in the list
format(object, JsString) Returns true if the given value passes validation against the configured `matcher` regex. For example: * validations: [{type: 'format', field: 'username', matcher: /([a-z]+)[0-9]{2,3}/}] * @param {Object} config Config object @param {String} value The value to validate @return {Boolean} True if the value passes the format validation
inclusion(object, JsString) Validates that the given value is present in the configured `list`. For example: * validations: [{type: 'inclusion', field: 'gender', list: ['Male', 'Female']}] * @param {Object} config Config object @param {String} value The value to validate @return {Boolean} True if the value is present in the list
length(object, JsString) Returns true if the given value is between the configured min and max values. For example: * validations: [{type: 'length', field: 'name', min: 2}] * @param {Object} config Config object @param {String} value The value to validate @return {Boolean} True if the value passes validation
presence(object, object) Validates that the given value is present. For example: * validations: [{type: 'presence', field: 'age'}] * @param {Object} config Config object @param {Object} value The value to validate @return {Boolean} True if validation passed

Properties

Name Description
emailMessage @property {String} emailMessage The default error message used when an email validation fails
emailRe The regular expression used to validate email addresses @property emailRe @type RegExp
exclusionMessage @property {String} exclusionMessage The default error message used when an exclusion validation fails.
formatMessage @property {Boolean} formatMessage The default error message used when a format validation fails.
inclusionMessage @property {String} inclusionMessage The default error message used when an inclusion validation fails.
lengthMessage @property {String} lengthMessage The default error message used when a length validation fails.
presenceMessage @property {String} presenceMessage The default error message used when a presence validation fails.
singleton @extends Object @author Ed Spencer * This singleton contains a set of validation functions that can be used to validate any type of data. They are most often used in {@link Ext.data.Model Models}, where they are automatically set up and executed.
© Copyright 2005-2011 SharpKit. All rights reserved.