Hello friends!
I have a form having some text boxes, radio buttons, and select boxes. I write custom validation methods which i added using validator.addmethod. If user submitted this form keeping some or all fields empty then form should get submitted but if user enters data in text boxes then data should be alphabetic and should not contain special character and numbers. I write validation code for some text boxes for which the custom validation code as I mentioned above is as follows.
$.validator.addMethod('specialchar', function (value) {
return /^[^a-zA-Z]$/.test(value);
}, 'First Name should not contain special characters.');
- *Now actually when user submits form with empty fields then error messages of above custom validation method is displayed for those textboxes to which above method is assigned *
- I think there is also problem in my regular expression which i can not able to spot. If my regular expression is right then is there any other method to add regular expression in JQuery i.e. lookahed regular expression.
Please help me on these two problems guys Thank You