In Javascript onload I have the following variable and function which are working fine to calculate and display the BalanceSheetChecks field
var ctrlbalsheetcheck= Runner.getControl(pageid, 'BalanceSheetChecks');
function func() {
ctrlbalsheetcheck.setValue(Number(ctrlCAtotal.getValue()) + Number(ctrlNCAtotal.getValue())- Number(ctrlCLtotal.getValue())- Number(ctrlNCLtotal.getValue())- Number(ctrlEQtotal.getValue()));
};
The problem is when I introduce the following code to hide or show the BSCheckExpl field when a value of the BalanceSheetChecks field does not equal zero, it does not show or hide the field when required.
var ctrlbscheckexp = Runner.getControl(pageid, 'BalanceSheetChecks');
ctrlbscheckexp.on('change', function(e) {
if (this.getValue() != 0) {
pageObj.hideField("BSCheckExpl");
} else {
pageObj.showField("BSCheckExpl");
}
});
Please let me know if you can identify what I am doing wrong in the above code.