[jQuery] [validator] custom rule with additional params

2009-02-04 Thread yongbin

Hi
at first, I really thanks for great efforts in Jquery and
validator.they reduce our time and work less than half. now, we can't
write even simple script without them

recently, I tried to make custom rule method that called with 3
arguments
such as...

 ( I use metadata plugin )

and my custom method is

jQuery.validator.addMethod("range_exp", function(value, element,
params) {
return this.optional(element) || ( (value >= params[0] && value <=
params[1]) || value == params[2] );
}, "Please enter between {0} and {1} or {2}");

I just need some exception for range rule. but It didn't work. IMO
there are some problems in params handle process. any idea?

Thanks.

yongbin




[jQuery] Re: [validator] custom rule with additional params

2009-02-06 Thread yongbin

it works . I doubted similar reason too but  I couldn't catch because
of  another silly quoting mistake.
after read your reply I found my mistake. thank you for your help

yongbin

On Feb 5, 5:47 pm, Jörn Zaefferer 
wrote:
> Looks like you didn't pass along proper JavaScript, try this:
>
> 
>
> Note the quotes around ND.
>
> If that isn't it, please provide a testpage.
>
> Jörn
>
> On Thu, Feb 5, 2009 at 2:21 AM, yongbin  wrote:
>
> > Hi
> > at first, I really thanks for great efforts in Jquery and
> >validator.they reduce our time and work less than half. now, we can't
> > write even simple script without them
>
> > recently, I tried to make custom rule method that called with 3
> > arguments
> > such as...
>
> >  ( I use metadata plugin )
>
> > and my custom method is
>
> > jQuery.validator.addMethod("range_exp", function(value, element,
> > params) {
> >return this.optional(element) || ( (value >= params[0] && value <=
> > params[1]) || value == params[2] );
> > }, "Please enter between {0} and {1} or {2}");
>
> > I just need some exception for range rule. but It didn't work. IMO
> > there are some problems in params handle process. any idea?
>
> > Thanks.
>
> > yongbin