Hello,
I'm using below function to have arithmetic ability on lose focus event for apex item (Example: input: 10000+10000 and output will be 20,000)
function fnc_arithmeticAbility(apexitem)
{
if (($v(apexitem)).match(/(\d)(?=(\d{3})+(?!\d))/g, '$1,'))
{
var value;
value = eval($v(apexitem));
$s(apexitem, Number(value).toFixed(0).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,'));
}
else if($v(apexitem).match(/[-+/*]+/g))
{
if(!(($v(apexitem)).match(/(\d)(?=(\d{3})+(?!\d))/g, '$1,')))
{
var value;
value = eval($v(apexitem));
$s(apexitem, Number(value).toFixed(0).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,'));
}
}
}
But whenever, if results are negative like -10,500 then on lose focus event it returns only 500.
How can I prevent that?
Note: It's not happening with positive numbers, it happens only for negative numbers.
Thanks in Advance!
Vinish Kapoor
I have tested this on lose focus and on change event, and it is working fine for me. Maybe you have defined some format mask?