CalcBuilder Forum

Number Format = 1000 -> 1,000 ?

User moon_694 2012-09-17 15:07:45

Hello, thank you for such a good tool. It works great. I have just small issue with large numbers = comma does not show up after 3 digits. I set "Frontend Number format" in preferences, but when I fill form click on calculate, numbers show without commas. Could you please help me? Thank you

Moonsoft support 2012-09-17 15:50:35

Hello,
thank you for your feedback. When you change the front end format, you are configuring the number validator for user input. In order to show formatted output, you have to use number format function at the end of your calculator code, formatting your result as required, something like:

$yourresult=number_format($yourresult,2,'.',',');

Please find information about this function here:


http://www.php.net/manual/en/function.number-format.php

To check an example we suggest to download and import the example calculator '4 basic operations & formatting numbers',where you can see how different formatting are applied to the results.

Hope this helps, regards

...
CalcBuilder

Create dynamic calculators

Buy now!
...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!