> -----Original Message-----
> From: jason [mailto:[EMAIL PROTECTED] 
> (1) How do you control where the error label appears for grouped
> elements like radio buttons and checkboxes? Right now it's appearing
> right after the first one for me.

See 'errorPlacement' - example code below - this checks to see if I have
a div or span after my label - if so it places the error AFTER those
elements. If not it defaults to inserting it right after the label.

$("#frmtelework").validate({
                errorPlacement: function(label, element) {
                if ( element.next("div").length ) {
                    label.insertAfter( element.next() );
                } else if ( element.next("span").length ) {
                    label.insertAfter( element.next() );
                }
                else {
                    label.insertAfter( element );
                }
                $(label).wrap('<div class="errormsg"></div>');
                    },
        rules: {
            // to make hidden elements required do:
            // elementwhichishidden: {required:
"#parentelement:visible"},
            personIDdisplay:    {required: true},
            homeaddress1:               {required: true},
            homecity:  ..........

> 
> (2) How do you indicate dependencies within the markup, as opposed to
> within the plugin call? In other words, if I have a group of radio
> buttons, and a text input that is only required if a certain radio
> button is checked, can I add something to the markup of the text input
> to indicate that?


I haven't done that but I think you could use the visible example like
I've shown above to do something similar:

        elementwhichischecked: {required: "#parentelement:checked"}

Or something along those lines...

Jim

Reply via email to