This topic is locked
[SOLVED]

Calculate values on the fly issue

4/20/2022 8:27:20 PM
PHPRunner General questions
A
alfonso authorDevClub member

I read this link https://xlinesoft.com/phprunner/docs/how_to_calculate_values_on_the_fly.htm and I try to use it but I don't know what must I put in "keyup" value
var ctrlneto = Runner.getControl(pageid, 'neto');
var ctrliva = Runner.getControl(pageid, 'iva');
var ctrltotal = Runner.getControl(pageid, 'total');

function func() {
ctrltotal.setValue(Number(ctrlneto.getValue()) + Number(ctrliva.getValue()));
};

ctrlneto.on('keyup', func);
ctrliva.on('keyup', func);

I get in total field "NaN" value

Thanks

A
alfonso authorDevClub member 4/20/2022

If solved with:
function func() {
ctrlTotal.setValue((+ctrlNeto.getValue()) +
(+ctrlIva.getValue()));
};

A
alfonso authorDevClub member 4/21/2022

The problem is that I use the comma , as decimal separator and it works fine when adding and editing records, but when doing these calculations it fails because the decimal separator has to be the point. How can I solve it?
Thanks