I have a form that requires a field to not have any special characters or numerics. Currently it works fine with:
abc
: no error.123
: error.!@#$
: error.
The issue is when I add something like #$%abc
or abc123
it does not produce the the error I would expect.
The function I am using looks like:
$.validator.addMethod("checkallowedchars", function (value) {
var pattern = new RegExp('[A-Za-z]+', 'g');
return pattern.test(value)
}, "The field contains non-admitted characters");
JSFiddle shows the function/regex I am using: http://jsfiddle.net/nmL8maa5/