CalcBuilder Forum

Number format

Usuario _MSTeam# 2014-05-19 09:05:44

We need to apply a number format to the calculator in the cost table. This is the format we want to follow:

1,000
10,000
100,000
1,000,000

I saw an old post where you showed someone how to do it in PHP (which we don't want to do since our calc is now quite complicated) - but with the new version you have a section on number format for decimal and '000' spacing - why is there no button to turn this on?

Please help!

Usuario _MSTeam# 2014-05-19 09:11:42

Hi,
the format parameters you can see at the backend configure the numeric format allowed for users to type at the input form. It's applied to any input field typed 'number'. In order to configure the output format you must use the number_format function at the code section.

For your specific calculator, you have the results assigned at the last line of the calculator:


$$key=$value;


so you only need to add the numeric format before that line:

$value=number_format($value,0,".",",");
$$key=$value;


//You can change 0 for the number of decimal positions you want to force at the results.


Hope this helps, regards

...
List Manager

Build different lists for your site

Buy now!
...
Support/development 10 hours

Get a bigger amount of hours for more complex tasks and get a 10% discount

Buy now!