errorPlacement is called only once per label, to insert it, but not
when its updated.

You should use showErrors instead, though that won't provide the
validation method either. Though you should be able to compare the
message with the default for that message or the one you specified.

Jörn

On Wed, Dec 3, 2008 at 1:56 AM, TheChrisPratt <[EMAIL PROTECTED]> wrote:
>
> Is it possible to get the failed rule name within the errorPlacement
> function?  There are many times when my requirements want me to put
> error messages in different places depending on which rule failed, and
> I haven't been able to figure out a clean way of doing it.  Something
> like:
>
>    $("#dddForm").validate({
>      rules: {
>        state:  { required: function() { return $("#zip").is
> (":blank"); } },
>        zip:    { zipcode:  true, required: function() { return $
> (this).is(":filled") && $("#state").is(":blank"); } },
>      },
>      groups: {
>        stateZip: "state zip"
>      },
>      messages: {
>        state:  "Either City/State or Zip is required",
>        zip:   { zipcode: "Invalid Format",
>                 required: "Either City/State or Zip is required"},
>      }
>    });
>
> The basic requirement here is if the required function fails for
> either field, display the error message at the top of the screen,
> since it applies to more than one field.  If the zipcode rule fails,
> display the error next to the field, since it only applies to that
> field.
>
> Any ideas?
>  (*Chris*)
>

Reply via email to