Online form conditions

All WYSIWYG Web Builder support issues that are not covered in the forums below.
Forum rules
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
Post Reply
cmsintent
 
 
Posts: 54
Joined: Tue Oct 09, 2007 4:59 pm
Location: Alberta, Canada
Contact:

Online form conditions

Post by cmsintent » Wed Sep 13, 2017 6:16 pm

Good Morning Pablo

In the CONDITION > CHANGE > CALCULATE is there something I can add to the EXPRESION formula: [quanity1] * 12.05 so that the total is only 2 decimal points and rounded up.

On my form, when I add Quantity of 3 ... I get total of 36.150000000000006 (which is really weird)

Thanks ..

I did refer to the FORM CONDITIONS HELP FILE but didn't see anything.

Is there a reference somewhere of what expressions can be used?

Thanks... appreciate all you do.

User avatar
Pablo
 
Posts: 19653
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: Online form conditions

Post by Pablo » Wed Sep 13, 2017 6:23 pm

Expressions use standard JavaScript syntax, so you can use any valid Javascript function.
https://www.w3schools.com/jsref/jsref_tofixed.asp

cmsintent
 
 
Posts: 54
Joined: Tue Oct 09, 2007 4:59 pm
Location: Alberta, Canada
Contact:

Re: Online form conditions

Post by cmsintent » Sat Sep 16, 2017 6:33 pm

Hi Pablo ... sorry to be a pain. I have tried every combination I could think of to get the number (decimal points) to round to 2 only ... can't figure it out.

From the www.w3shools.com website I got their example:

number.toFixed(x)
var num = 5.56789;
var n = num.toFixed(2)

---------------------
CONDITION I AM USING
[quantity9] * 37.65

BUT when on the form if the quantity9 is inputted as 3 ... I get a total of 112.94999999999999 (instead of 112.95)
---------------------
Could you please take a moment and let me know how the condition I am using should look ... would really appreciate it.

cmsintent
 
 
Posts: 54
Joined: Tue Oct 09, 2007 4:59 pm
Location: Alberta, Canada
Contact:

Re: Online form conditions

Post by cmsintent » Sat Sep 16, 2017 6:56 pm

Pablo... sent last message to soon ... sorry

I found in your BMI example how you set the conditions for rounding

I was missing the before and after ( )

Now the formula looks like this:

(([quantity9] * 37.65).toFixed(2))

It now rounds to 2 decimal points.

Only thing is .. on the w3school example ... it will uses a 0 for the last digit
eg: 37.65 x 2 = 75.30 ... on my form it shows as 37.65 x 2 = 75.3

Not sure why?

User avatar
Pablo
 
Posts: 19653
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: Online form conditions

Post by Pablo » Sat Sep 16, 2017 8:51 pm

Not sure why?
The code in executed by the browser. The results may be different in a different browser. This is unrelated to WWB.

Post Reply

Who is online

Users browsing this forum: crispy68 and 14 guests