This topic is locked
[SOLVED]

 calculation values on the fly

1/10/2012 1:25:17 AM
PHPRunner General questions
L
lkh11lkh author

hi
could anyone help me to see the coding any wrong below? really appreciated

because when i add 3 fields = total but it only calculate 2fields (OrderDetail1+OrderDetail2)= total
calculation values on the fly-JavaScript OnLoad Event =>v5.3 7474
var ctrlOrderDetail1 = Runner.getControl(pageid, 'OrderDetail1');
var ctrlOrderDetail2 = Runner.getControl(pageid, 'OrderDetail2');
var ctrlOrderDetail3 = Runner.getControl(pageid, 'OrderDetail3');
var ctrlTotal = Runner.getControl(pageid, 'TotalCost');
function func() {
if ( ctrlOrderDetail1.getValue()!='' && ctrlOrderDetail2.getValue() && ctrlOrderDetail3.getValue() && !isNaN(ctrlOrderDetail1.getValue()) && !isNaN(ctrlOrderDetail2.getValue()) && !isNaN(ctrlOrderDetail3.getValue()))
ctrlTotal.setValue(parseFloat(ctrlOrderDetail1.getValue()) + parseFloat(ctrlOrderDetail2.getValue()) + parseFloat(ctrlOrderDetail3.getValue()));
else
ctrlTotal.setValue('');
};
ctrlOrderDetail1.on('keyup', func);
ctrlOrderDetail2.on('keyup', func);
ctrlOrderDetail3.on('keyup', func);

L
lkh11lkh author 1/10/2012

hi
sorry, its works after i refresh my broswer.

thanks