This topic is locked
[SOLVED]

 Automatically change a field value

9/7/2019 5:44:04 PM
PHPRunner General questions
A
AndrewMark author

I have a variable value ctrlbalsheetcheck which is created as a result of the formulae:
var ctrlbalsheetcheck= Runner.getControl(pageid, 'BalanceSheetChecks');

ctrlbalsheetcheck.setValue(Number(ctrlCAtotal.getValue()) + Number(ctrlNCAtotal.getValue())- Number(ctrlCLtotal.getValue())- Number(ctrlNCLtotal.getValue())- Number(ctrlEQtotal.getValue()));
This formulae is working as expected.
However each time the ctrlbalsheetcheck value is changed I need the variable BSCheckDesc (see below) to automatically change.
The ctrlbalsheetcheck field is never changed by user input directly to this field but only by user input changing one of the component variables of the above formulae ie ctrlCAtotal,ctrlNCAtotal,ctrlCLtotal etc..
I have entered the below code and the automatic change is not occurring. I think perhaps it may be because the

ctrlbalsheetcheck field is not being changed by user input directly on it, but rather it is a result of component fields as described above.
This is the current coding for it but it does not work as BSCheckDesc does not automatically change when ctrlbalsheetcheck changes:
ctrlbalsheetcheck.on('change', function(e) {

var BSCheckDesc = "Balance sheet is out of balance by $" + ctrlbalsheetcheck.getValue();

var ctrlBSCheckDesc = Runner.getControl(pageid, 'BSCheckDesc');

ctrlBSCheckDesc.setValue(BSCheckDesc);

});
Please assist if possible.

Sergey Kornilov admin 9/8/2019

'change' event is not triggered when you change ctrlbalsheetcheck field programmatically. When you change the value of ctrlbalsheetcheck in your code you should also change all related fields as well.

A
AndrewMark author 9/8/2019



'change' event is not triggered when you change ctrlbalsheetcheck field programmatically. When you change the value of ctrlbalsheetcheck in your code you should also change all related fields as well.



thanks