JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.
How Do I Get the Result of a Calculation to Be Formatted Like Currency, With Commas for Large Amounts?Asked by fhpw on March 21, 2015 at 06:48 PM
I used the form calculation. However, it does not seem to work on currency values. I am asking users to provide expected expenses. It will total only if decimal places are not used. Even though I set the field to currency format the $ or commas do not show. For example, user has to input
1000 + 200 = $1200
Is there a way to have the currency fields show $ and commas and the calculating field include the comma?
Although there's no way in the form builder to have commas shown, the amount displayed in the Total Expect(ed) Costs field can be made to more closely resemble currency if two decimal places are included for every result. This can be rectified as follows:
1. Click the total field and then its wizard icon (button)
2. Click Show Advanced Options:
3. Check the box labelled Show empty decimal places.:
4. Save the jotform
Now, if you really need the decimals to be shown, the only workaround I can think of would be to get a copy of the form's full source, embed it into a web page of your own and then add a script to the same page. Some time ago I provided a script to do this for another user's form. Just let me know and I'll see what I can do for you.
That works great for the calculator field. However, the text fields - even though marked as currency - does not allow decimal places or the $ sign if using the calculator.
You know what? We actually have a widget named Masked Input that would format the inputs of the two operand fields (Tuition and Fees and Books) exactly as you want them. (Please see this guide.) However, you would have to delete the said fields and replace them and once that's done, all data which would have been submitted via the current fields will be deleted. So, please download all of the form's submissions to your computer before replacing the fields. Of course, you will need to edit the expression in the Total Expect(ed) Costs field to suit.
And while we're on the subject of the total, there's still no way to have commas auto-inserted into that field's value, unless the aforementioned full source code and custom script workaround is used.
Here's an abridged version of your jotform with the Masked Input widget.
If you need further assistance with this, we'd be glad to provide it.
That looks great! Thanks. I will try it. I have not taken the form live, so I have no problem making the change. I am looking for consistency and the abridge version looks like it will work. I needed commas or the $ sign and decimals, but did not necessarily have to have both.
I applied the solution and it worked. Thank you!
You're quite welcome. If there's anything else with which you need assistance, please inform us.