Buy Now
Sign in

Calculator Doesn't Like Change

U Can Drive , June 03 at 07:25
U
U Can Drive
I have a simple calculator set up which doesn't really seem to like change.

​It's for a purchase form, selecting the number of lessons, I've used dropdowns to select the number you want (1-10) and a second and third for other options.
If you change the selections, some times it's okay, but then it starts throwing in strange numbers to the point that bringing it all back to 0 results in something like:
$-4.263256414560601E14
I've put a test form together that shows the exact same problem. Please play with all three, especially changing Number One to a lower number.
https://ucandrive.com.au/index.php?option=com_chronoforms6&chronoform=testform
GreyHead
Hi U Can Drive,
There are a bunch of JavaScript errors on the page you linked to so I checked without the template and the forms seems to work correctly bar some odd rounding errors, you can fix those by formatting the result to show only two decimal places.
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
U
U Can Drive
Okay, so I've put in a work around for now (initial value = 0.0001 so it never returns to 0 where the major mess up happens.
How do I format the result to only show two decimal places?
GreyHead
Hi U Can Drive,
Hmmm I'm not sure that you can if you are using the Event Code. You could using custom JavaScript.
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
U
U Can Drive
Hey Bob,
Could you please let me know what code to use to get the total showing only two decimal points? As you know I'm not so good at the coding aspects of this.