The groups-option is processed by the plugin and added to the
validator object. So inside your errorPlacement-method you should be
able to use this.groups[element[0].name] to get the group for that
element, if any.

Jörn

On Fri, Mar 20, 2009 at 4:32 PM, doutu <ami...@gmail.com> wrote:
>
> If this feature  exists now, tell me please. If not, just a feature
> request!
> What's my plan ?
>
> <div id="err_group_id1">invalid error place holder</div>
> <ul><li><input type="checkbox" name="g1[]" id="" value="" /></li>
> <li><input type="checkbox" name="g1[]" id="" value="" /></li>
> <li><input type="checkbox" name="g1[]" id="" value="" /></li>
> <li><input type="checkbox" name="g1[]" id="" value="" /></li>
> </ul>
>
> <ul><li><input type="checkbox" name="g2[]" id="" value="" /></li>
> <li><input type="checkbox" name="g2[]" id="" value="" /></li>
> <li><input type="checkbox" name="g2[]" id="" value="" /></li>
> <li><input type="checkbox" name="g2[]" id="" value="" /></li>
> </ul>
>
> <script type="text/javascript">//<![CDATA[
> $("#myform").validate({
>  groups: {
>    err_group_id1: "g1[] g2[]"
>  },
>  errorPlacement: function(error, element) {
>     if (element.group_key)
>       error.appendTo('#' + element.group_key);
>     else
>       error.insertAfter(element);
>   }
>  })
> //]]></script>
>

Reply via email to