How do I format a calculated field to be 2 decimal points?

  • gongolfltd
    Asked on June 23, 2014 at 1:49 AM

    I Have a calculated field that is used to apply a discount.

     

    The calculation works fine - but the results show the actual number - I want it to always show 2 decimals.

     

    Appreciate the help.

     

    Thanks

     

     

  • Ashwin JotForm Support
    Replied on June 23, 2014 at 3:59 AM

    Hello gongolfltd,

    Please be noted that by default, the decimal places are already allowed in the "Form Calculation" widget.  It will display the value in decimal but if there is no value after decimal it will not display ".00". For example if the calculation returns "1.12" it should display correctly but if it is "1.00", it will only display "1" as the output.

    Upon checking your form, I found that you have correctly and the decimal seems to display correctly except the ".00" which I have explained above. Please check the screenshot below:

    How do I format a calculated field to be 2 decimal points? Image 1 Screenshot 30

    To be able to display the ".00" / "Empty decimal places", you need to select the "Show empty decimal places." option in the "Advanced Options" of your "Form Calculation" widget. Please chekc the screenshot below:

    How do I format a calculated field to be 2 decimal points? Image 1 Screenshot 30

    I have fixed it in your form "GNL Booking Form". Do check and get back to us if your form is now working as expected.

    Thank you!

  • silentnightllc
    Replied on February 4, 2015 at 1:20 PM

    I see that the live form referenced in this question has two decimal places showing at all times. How can I make this happen as well. My form currently only shows the second decimal place when it is greater than zero.

     

    Thanks!

  • David JotForm Support
    Replied on February 4, 2015 at 2:42 PM

    Hi,

    Usually for older threads like this we ask that you create a new thread so that we may address your issue separately.  In this case however, the answer to your questions is fairly short so I'll keep it in this thread.

    In the "Advanced Options" in your calculation field, there is an option to set the number the number of decimal places for numerical values and to show empty places:

    How do I format a calculated field to be 2 decimal points? Image 1 Screenshot 20

    If you have any further questions, please create a new thread so that we may address your issue properly.