[jQuery] [validate] Validation depending on checkboxes

[jQuery] [validate] Validation depending on checkboxes


hi,
I have 2 fieldsets with checkboxes depending on each other. In the
first fieldset, you can choose values between 1 and 6 and if you
choose e.g. checkbox with the value 3, I want to have a the value 3 as
the maxLength value for the second checkbox fieldset.
What I just have right now: if one of the checkboxes in fieldset one
ist checked, the required value of the second one is true, but I can't
get the maxLength value.
Here is my Code so far:
function anzahl() {
if ($("#anzBest1").is(":checked")) {
return 1;
}
else if ($("#anzBest2").is(":checked")) {
return 2;
}
}
$("#bestellForm").validate({
rules: {
    anzBestellung: {
        required: true,
        maxlength:1
    },//anzBestellung
     anzAusgabe: {
         required: function(element) {
return jQuery("#anzBest1").is(":checked") ||
jQuery("#anzBest2").is(":checked") || jQuery("#anzBest3").is
(":checked") || jQuery("#anzBest4").is(":checked");
         },
maxlength: anzahl() // <---- here is my problem, how
do I get the value form anzBestellung?
    }//AnzAusgabe
}//rules
});//validate
Thanks a lot for your help!