Look at the implementation of the digit-method as a reference. Jörn
On Fri, May 29, 2009 at 12:27 PM, VaN <fanel....@gmail.com> wrote: > > What if I want to edit allowed keys ? Integer was an example. in fact, > I'd like to allow "a-z", "1-9" underscore, hyphen and dot. How to do > that ? > > On May 29, 9:05 am, Jörn Zaefferer <joern.zaeffe...@googlemail.com> > wrote: >> The "digits" method does just >> that:http://docs.jquery.com/Plugins/Validation/Methods/digits >> >> Jörn >> >> On Thu, May 28, 2009 at 4:03 PM, VaN <fanel....@gmail.com> wrote: >> >> > Hi, >> >> > I'm trying to make my password field regex-valid, but don't know what >> > to add. >> >> > Here is my code : >> >> > $.validator.addMethod("integer", function(value, element) { >> > return !jQuery.validator.methods.required(value, element) >> > || /^\d+$/ >> > i.test(value); >> > } >> > , "Numbers only please"); >> >> > $("#register_form").validate({ >> >> > rules: { >> >> > user_password: { >> > minlength: 6, >> > integer:true >> > }, >> > } >> >> > }); >> >> > But this does not work. Did I make something wrong ? >