I have a form with multiple boolean fields. When one of the fields is marked "True" I want certain corresponding fields to be shown.
I have onChange events set for these boolean fields to call the function "REP.Report.showCorrespondingField". When I change the value of the fields, the onChange event is not triggered and the function is not called, regardless of which control is used - toggle, checkbox or list. However, I have a couple integer fields elsewhere on the form where the onChange event is being triggered correctly.
Please help me figure out why these fields are triggering onChange! TIA!
var REP = REP || {};
REP.Report = REP.Report || {};
let formContext = null;
(function() {
'use strict';
REP.Report.onLoad = function(executionContext) {
formContext = executionContext.getFormContext();
}
REP.Report.showCorrespondingField = function(changedField,hiddenField1,hiddenField2) {
if(changedField === true) {
formContext.getControl(hiddenField1).setVisible(true);
if(hiddenField2) {
formContext.getControl(hiddenField2).setVisible(true);
}
}
};
REP.Report.setTotalHours = function() {
let primHours = formContext.getAttribute('new_q3atotalhoursprimary').getValue();
let secHours = formContext.getAttribute('new_q3btotalhourssecondary').getValue();
formContext.getAttribute('new_q3ctotalhours').setValue(primHours secHours);
}
})();
