I'm having trouble with this one. Could we combine two requirements in JavaScript?
1) Disable Submit until "Yes, Approved" is checked off on a checkbox field.
2) If "No, Send Back to Assistant" is checked off instead, then make the Comment box REQUIRED.
- The checkbox has CSS Class of ckboxRequired
- The Comment box has CSS Class of ckboxifRequired
And here is what I was playing with but is not working (there is no other JavaScript on the page) which I found pieces of on other Answers posts:
$(document).ready(function() {
$('.Submit').attr("disabled", "disabled");
});
//This is for the 2nd Approver Comments box to become Required
$(document).ready(function () {
$('.ckboxifRequired input').on('change', 'input',function () {
if ($(this).is('No, Send Back to Assistant':checked)) {
$('.ckboxRequired label').append('<span class="cf-required">*</span>');
$('.ckboxRequired textarea').attr('required', 'True');
//alert('if');
} else {
$('.ckboxRequired span.cf-required').remove();
$('.ckboxRequired textarea').removeClass('required').removeAttr('required');
}
});
});