Skip to content

Instantly share code, notes, and snippets.

@JoeChapman
Created February 24, 2012 14:29
Show Gist options
  • Save JoeChapman/1901243 to your computer and use it in GitHub Desktop.
Save JoeChapman/1901243 to your computer and use it in GitHub Desktop.
Defines types validation
(function($, window, validator, undefined) {
validator.types = {
isValidEmail: {
validate: function(value) {
return '/^$/'.test(value);
},
instructions: 'Please enter a valid email address',
errorHandler: function() {
validate.instructions;
}
},
notEmpty: {
validate: function (value) {
return value !== '';
},
instructions: 'field cannot be empty'
}
};
}(jQuery, window, (validator || {})));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment