Replace the function updateNotApplicableQuestion with this specialized version:
function updateNotApplicableQuestion(baseQuestion, naQuestion, name, bln) {
$('#[% QuestionName() %]_1').closest('.clickable').css('display', 'inline-block').css('width', 'auto');
var ageQuestion = $('.question.numeric').attr('id').replace(/_div/, '');
var sexQuestion = $('.question.select').attr('id').replace(/_div/, '');
if (bln) {
$('#' + ageQuestion).val('');
$('#' + ageQuestion).prop('disabled', true);
SSI_RadioReset(sexQuestion);
SSI_DisableGraphicalInput(sexQuestion + '_1');
SSI_DisableGraphicalInput(sexQuestion + '_2');
}
else {
$('#' + ageQuestion).prop('disabled', false);
SSI_EnableGraphicalInput(sexQuestion + '_1');
SSI_EnableGraphicalInput(sexQuestion + '_2');
}
}
Then replace the verification with this:
var ageQuestionDiv = $('.question.numeric');
var ageQuestion = $(ageQuestionDiv).attr('id').replace(/_div/, '');
var sexQuestionDiv = $('.question.select');
var sexQuestion = $(sexQuestionDiv).attr('id').replace(/_div/, '');
var age = $('#' + ageQuestion).val();
var sex = SSI_GetValue(sexQuestion);
var notApplicable = SSI_GetValue('[% QuestionName() %]_1');
$(ageQuestionDiv).removeClass('error_quest_highlight2');
$('#' + ageQuestion + '_err2').remove();
if (age === '' && !notApplicable) {
strErrorMessage = 'Question must be answered or "Not Applicable" must be selected.';
$(ageQuestionDiv).removeClass('error_quest_highlight');
$('#' + ageQuestion + '_err').remove();
$(ageQuestionDiv).addClass('error_quest_highlight2');
$(ageQuestionDiv).prepend('<div id="' + ageQuestion + '_err2" class="question_error_box error_messages"></div>');
$('#' + ageQuestion + '_err2').append('<div class="question_errors">' + strErrorMessage + '</div>');
}
$(sexQuestionDiv).removeClass('error_quest_highlight2');
$('#' + sexQuestion + '_err2').remove();
if (sex == 0 && !notApplicable) {
strErrorMessage = 'Question must be answered or "Not Applicable" must be selected.';
$(sexQuestionDiv).removeClass('error_quest_highlight');
$('#' + sexQuestion + '_err').remove();
$(sexQuestionDiv).addClass('error_quest_highlight2');
$(sexQuestionDiv).prepend('<div id="' + sexQuestion + '_err2" class="question_error_box error_messages"></div>');
$('#' + sexQuestion + '_err2').append('<div class="question_errors">' + strErrorMessage + '</div>');
}
"DisableGraphicalInputs" from the Community Question Library is still required, of course.