This topic is locked

Trouble hiding and showing a field

8/26/2019 8:24:09 AM
PHPRunner General questions
A
AndrewMark author

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.

Sergey Kornilov admin 8/26/2019

As a first step make sure you don't have any Javascript errors there:

https://xlinesoft.com/phprunner/docs/troubleshooting_javascript_errors.htm