I\'m using the jQuery Validation Plugin on my form. On my form I have a \'Telephone\' field and a \'Mobile No.\' field.
How would I go about making it so the user ha
Requirement is Validation need to be either C or (A and B) is required. The thing worked for me is:
$.validator.addMethod("multipeFieldValidator", function(value) {
var returnVal = false;
if($("#Cfield").val() != '' || ($("#Afield").val() != '' && $("#Bfield").val() != '')) {
returnVal = true;
}
return returnVal;
}, 'Either C or A and B is required');
$('#Afield.form-control').change(function(){
$(this).valid();
$("#Bfield").valid();
$("#Cfield").valid();
});
$('#Bfield.form-control').change(function(){
$(this).valid();
$("#Afield").valid();
$("#Cfield").valid();
});
$('#Cfield.form-control').change(function(){
$(this).valid();
$("#Bfield").valid();
$("#Afield").valid();
});
within rules I have
Afield: "multipeFieldValidator",
Bfield: "multipeFieldValidator",
Cfield: "multipeFieldValidator"