Preserve full site structure: articles, blog posts, downloads, BLV Express, sitemap, legacy CSS/JS
This commit is contained in:
49
public/javascripts/plugins/jquery.validation.js
Normal file
49
public/javascripts/plugins/jquery.validation.js
Normal file
@@ -0,0 +1,49 @@
|
||||
(function($) {
|
||||
|
||||
var validation = function() {
|
||||
|
||||
var rules = { // Private object
|
||||
|
||||
email : {
|
||||
check: function(value) {
|
||||
|
||||
if(value) {
|
||||
var pattern = /^[a-zA-Z0-9\._-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z]{2,4}$/;
|
||||
return testValue(value, pattern);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
msg : ""
|
||||
},
|
||||
required : {
|
||||
|
||||
check: function(value) {
|
||||
|
||||
if(value) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
msg : ""
|
||||
}
|
||||
}
|
||||
var testValue = function(value, pattern) { // Private Method
|
||||
return pattern.test(value);
|
||||
}
|
||||
return { // Public methods
|
||||
|
||||
addRule : function(name, rule) {
|
||||
|
||||
rules[name] = rule;
|
||||
},
|
||||
getRule : function(name) {
|
||||
|
||||
return rules[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
//A new instance of our object in the jQuery namespace.
|
||||
$.validation = new validation();
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user