答案 0 :(得分:1)
您可以通过编写检查单选按钮值的自定义方法来执行此操作,并根据该值检查消息字段。这是您可以在jQuery中添加的代码
$.Validation.addRule("message",{
check: function(value) {
// Check the value of radio button here, You can do it as
if($("form input:radio:checked").val() == 'radio2') return true;
// radio2 is checked then return valid, ie. this field is not required field.
if(value.length > 0) {
return true;
}
return false;
},
msg : "Field is required."
});