Forums

Calculator Doesn't Like Change

U Can Drive 03 Jun, 2018
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 03 Jun, 2018
1 Likes
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
U Can Drive 04 Jun, 2018
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 04 Jun, 2018
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
U Can Drive 22 Jun, 2018
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.
This topic is locked and no more replies can be posted.