Wednesday, April 1, 2009

[jQuery] Re: [validate] How can I force element validation if the value is unchanged?

You could remove the cached value from the element data. Then call
valid() on that element to run the validation again.

Jörn

On Wed, Apr 1, 2009 at 3:21 AM, pbarnes <pmbarnes@gmail.com> wrote:
>
> I need to use an ASMX service to validate a phone number. The Web
> method requires the phone number and the countryId.
>
> I have the validation working fine except for the case where the user
> enters a valid number for, say, the default country (United States)
> and then selects some other country, not changing the phone number.
>
> I can force validation when the country dropdown value changes by
> using the validator.element() method. But because (previous.old !==
> value) returns true (see line 897 in jquery.validate.js), the ajax
> call isn't made. What's the best way to force this call so that I can
> validate remotely when the country changes?

No comments: