Calculation using an editbox

Issues related to forms.
Post Reply
sbinns@ifguk.com
 
 
Posts: 13
Joined: Thu Nov 02, 2023 12:16 pm

Calculation using an editbox

Post by sbinns@ifguk.com »

Hi

I have three editboxes, the third of which is a calculation of the inputted values of 1 & 2

That part works fine, however i want the result to be rounded up to a whole number as currently the decimal places run to infinite

Javscript does this using the script Math.round(x)

I have set a chnage event for Editbox 3 to run that Javascript, but it doesn't

Can anyone help please
User avatar
Pablo
 
Posts: 22986
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Calculation using an editbox

Post by Pablo »

You cannot round the value within an onchange event because updating the value during the event will trigger another onchange event, potentially causing an infinite loop.
You will need to round the value in the calculation itself.
Post Reply