Dave,
Thanks for the help. I think you'll be getting an email from me because I clicked "reply to author" on accident. So, sorry about that. I got everything working thanks to your tips and great example. I appreciate your assistance on this. Deron I-CRE8 wrote: > > > Deron, > > you would need to add the rule: > lettersonly: true // assuming you want name to be validated with > lettersonly > > to any set of rules that you want this method to apply to > > I have an example form set up here: > http://ecommerce.i-cre8.com/admin/add-new-test.php > that shows how you can set up custom rules > > Regards, > > Dave Buchholz > I-CRE8 Internet Solutions > http://www.i-cre8.co.uk > Skype: I-CRE8 > > > On Nov 30, 7:54 pm, deronsizemore <[EMAIL PROTECTED]> wrote: >> Hi! Thanks for the quick reply. So, with this code added, will it make >> all >> fields letters only or is there a way for me to specify what field(s) I >> want >> to allow letters only? >> >> Thanks, >> Deron >> >> >> >> I-CRE8 wrote: >> >> > On Nov 29, 11:06 pm, deronsizemore <[EMAIL PROTECTED]> wrote: >> >> >> The code is as follows: >> >> >> jQuery.validator.addMethod("lettersonly", function(value, element) { >> >> return this.optional(element) || /^[a-z]+$/i.test(value); >> >> >> }, "Letters only please"); >> >> >> My problem is that I'm not sure where to place the above code so that >> I >> >> can >> >> require only letters in one of my fields? >> >> > Hi, >> >> > you would please your code something like this: >> >> > <script type="text/javascript"> >> >> > jQuery.validator.addMethod("lettersonly", function(value, element) { >> > return this.optional(element) || /^[a-z]+$/i.test(value); >> >> > }, "Letters only please"); >> >> > $().ready(function() { >> > $("#submit").validate({ >> > errorPlacement: function(error, element) { >> > error.insertBefore(element); >> > }, >> > rules: { >> > name: { >> > required: true, >> > lettersonly: true // assuming you want name >> > to be validated with lettersonly >> >> > }, >> > email: { >> > required: true, >> > email: true >> > } >> > }, >> > messages: { >> > name: "Please enter your name", >> > email: { >> > required: "Please enter your email", >> > email: "Please enter a valid email >> > address" >> > } >> > } >> > }); >> >> > }); >> > </script> >> >> > Regards, >> >> > Dave Buchholz >> > I-CRE8 Internet Solutions >> >http://www.i-cre8.co.uk >> > Skype: I-CRE8 >> >> -- >> View this message in >> context:http://www.nabble.com/-validate--Allowing-letters-only-in-a-text-inpu... >> Sent from the jQuery General Discussion mailing list archive at >> Nabble.com. > > -- View this message in context: http://www.nabble.com/-validate--Allowing-letters-only-in-a-text-input--tp20752566s27240p20774748.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.