Hi

Using JQuery + Validate plugin. When I create a new custom rule using
a call to addMethod then use required:"myradio:checked" it will always
trigger the validation to fail even if the radio is unchecked. This
behaviour does not occur when you use the built in validation methods.

$.validator.addMethod("dropdown", function(value, element) {
     return element.selectedIndex>0;
},'');

$("#myform").validate({
                rules:{
                        mydropdown:{required:"#myradio:checked",dropdown:true}
                }
});

So even when #myradio is NOT checked the rule is saying that
validation has failed. What I would like to happen would be for
validated to check the "required" rule first, if the radio is
unchecked then it should return valid and drop calls to any other
validation methods.

Any ideas or have I got something backwards.

Thanks

Reply via email to