Thanks for the advice. I have set up the following code in Events in the add page for Javascript onload. Please let me know if you think any of the below can be improved to fix the problem
Firstly we have used the following code per https://xlinesoft.com/phprunner/docs/how_to_calculate_values_on_the_fly.htm
this has approximately 170 variables, followed by approximately 25 functions (mainly addition, subtraction type functions), followed by approximately 130 keyups
some of the 170 variable examples are:
var ctrlRev = Runner.getControl(pageid, 'OrdinaryRevenue');
var ctrlCogs = Runner.getControl(pageid, 'CostofGoodsSold');
var ctrlGrossprof = Runner.getControl(pageid, 'GrossProfit');
var ctrlOtherinc = Runner.getControl(pageid, 'OtherIncome');
some of the 25 functions examples are:
function func() {
ctrlGrossprof.setValue(Number(ctrlRev.getValue()) - Number(ctrlCogs.getValue()));
ctrlTotalexp.setValue(Number(ctrlAccfees.getValue()) + Number(ctrlDepre.getValue())+ Number(ctrlInsuran.getValue())+ Number(ctrlInterest.getValue())+ Number(ctrlRandD.getValue())+ Number(ctrlSalary.getValue())+ Number(ctrlOtherexp.getValue()));
ctrlProfbeftax.setValue(Number(ctrlGrossprof.getValue()) + Number(ctrlOtherinc.getValue()) - Number(ctrlTotalexp.getValue()) );
ctrlProfitafttax.setValue(Number(ctrlProfbeftax.getValue()) - Number(ctrlIncometaxexp.getValue()) );
some of the 130 keypus are:
ctrlRev.on('keyup', func);
ctrlCogs.on('keyup', func);
ctrlAccfees.on('keyup', func);
ctrlDepre.on('keyup', func);
then we have about 5 hide fields (first two per below):
pageObj.hideField("IfdifferentExplanWhy");
var ctrldifferent = Runner.getControl(pageid, 'IsSubjectEntityDifferent');
ctrldifferent.on('change', function(e) {
if (this.getValue() == 'yes') {
pageObj.showField("IfdifferentExplanWhy");
} else {
pageObj.hideField("IfdifferentExplanWhy");
}
});
pageObj.hideField("OtherType");
var ctrlothertype = Runner.getControl(pageid, 'EntityType');
ctrlothertype.on('change', function(e) {
if (this.getValue() == 'Other') {
pageObj.showField("OtherType");
} else {
pageObj.hideField("OtherType");
}
});
Then we have a hide tab function per below
var tabs = pageObj.getTabs();
tabs.hide(0);
tabs.hide(1);
tabs.hide(2);
pageObj.hideField("Whylessthan3prds");
var ctrlperiods = Runner.getControl(pageid, 'TypeofFinancials');
ctrlperiods.on('change', function(e) {
if (this.getValue() == 'three') {
tabs.show(0),tabs.show(1),tabs.show(2),pageObj.hideField("Whylessthan3prds");
}
if (this.getValue() == 'two') {
tabs.show(0),tabs.show(1),tabs.hide(2),pageObj.showField("Whylessthan3prds");
}
if (this.getValue() == 'one') {
tabs.show(0),tabs.hide(1),tabs.hide(2),pageObj.showField("Whylessthan3prds");
}
});