You mean using:

$.validator.addMethod('password', function (value, element) {
  return this.optional(element.value) || /^([a-zA-Z0-9]{8,24})
$/.test(value);
}, 'Use 8 to 24 letters or numbers only');

I have tried it before and I got the following error in Firebug:

element.nodeName is undefined
   switch (element.nodeName.toLowerCase()) {

What am I doing wrong?

Thanks,
Miguel


On Oct 25, 3:47 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]>
wrote:
> Its not a bug, but could be considered bad design. The first argument,
> value, is the trimmed value. Using element.value should fix the issue.
>
> Jörn
>
> On Fri, Oct 24, 2008 at 10:50 PM, shapper <[EMAIL PROTECTED]> wrote:
>
> > Hello,
>
> > I am validating a password field as follows:
>
> > $.validator.addMethod('password', function (value, element) {
> >  return this.optional(element) || /^([a-zA-Z0-9]{8,24})
> > $/.test(value);
> > }, 'Use 8 to 24 letters or numbers only');
>
> > I write 8 numbers and letters. The message disappears. Fine ...
>
> > Then I write a few spaces and the message do not fire even when I
> > submit the form.
>
> > Then I write a few letters or numbers after the empty spaces and the
> > message fires again ...
>
> > Is this a bug?
>
> > Thanks,
> > Miguel

Reply via email to