Is there a way to require a field only if a checkbox is checked?
I currently have a checkbox defined:
$(“#checkboxA”).jqxCheckBox({ width: 120, height: 25 });
And I have validation on a field:
$('#initalPageForm').jqxValidator({
rules: [
{ input: '#myDropdown', message: 'You must select a section', action: 'change', rule: function () {
var selectedIndexSection = $('#myDropdown').jqxDropDownList('selectedIndex');
var result = selectedIndexSection > 0;
return result;}
}
]
});
I would like to require myDropDown be selected ONLY if checkBoxA is checked. myDropDown is optional if checkBoxA is NOT checked.
Thanks!