Friday, February 26, 2010

Custom Validator in JQuery.Validate

$.validator.addMethod(
"regexName",
function(value, element) {
var check = false;
var re = new RegExp('^[a-zA-Z _0-9.]+$');
return this.optional(element) || re.test(value);
},
"No special characters allowed!"
);


rules: {
LoginName: {
required: true,
regexName:true
},

No comments:

Post a Comment