This topic is locked

Issue with calculation on the fly

4/7/2011 5:37:58 AM
PHPRunner General questions
Y
yksafo author

Hi,
I have this code for calculation on the fly(in a JavaScript OnLoad event) but for some reason the balanceand totalAmountthat is being sent to the database is 0 all the time. The calculations itself works fine and provides the correct results on the screen but 0 is stored in the database.



var ctrlTransferAmount=Runner.getControl(pageid,'transferAmount');

var ctrlTransferRate=Runner.getControl(pageid,'transferCharge');

var ctrlCommission=Runner.getControl(pageid,'commission');

var ctrltotalAmount=Runner.getControl(pageid,'totalAmount');

var ctrlBalance=Runner.getControl(pageid,'balance');



function func()

{

ctrltotalAmount.setValue(parseFloat(ctrlTransferAmount.getValue())*parseFloat(ctrlTransferRate.getValue())+parseFloat(ctrlCommission.getValue()));

ctrlBalance.setValue(parseFloat(ctrlTransferAmount.getValue())*parseFloat(ctrlTransferRate.getValue()));

ctrlBalance.setDisabled();

ctrltotalAmount.setDisabled();

};

ctrlTransferAmount.on('keyup',func);

ctrlTransferRate.on('keyup',func);

ctrlCommission.on('keyup',func);


I have also have this code to set the values of the balance and totalAmount in the Before record Added event and still getting 0 stored in the database.

$values["totalAmount"]=($values["transferAmount"] * $values["transferRate"] )+ $values["commission"];

$values["balance"]=($values["transferAmount"] * $values["transferRate"] );


How can I make sure the result that I see on the screen goes into the database as well.
Thx....

Sergey Kornilov admin 4/7/2011

Your code looks good on the surface.
I recommend to post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.