Thousands separator in number field?

By: Fidan Jovanov | Asked: 12/21/2022
ForumsCategory: How-toThousands separator in number field?
Fidan Jovanov asked 2 years ago
Is there a way to have a calculated number field show its value with the thousands separated by a ','? I'm taking about in the form itself, I know it is possible to do so in a view or email.
3 Answers
Best Answer
Fidan Jovanov answered 2 years ago
Yeah so it doesn't matter that the field is a "number" field in particular as it is a read-only calculation result field that should display the amount of data in megabytes. I'll try now with currency format, ideally without the currency symbol and decimals Essentially, what I need is this https://formidableforms.com/knowledgebase/number/#kb-thousands-separator but in the form itself UPDATE: Currency format worked.
Bobby Clapp answered 2 years ago

So as you type it? Like if I typed in 1000, it would auto convert to 1,000? Probably not a number field.

That's doable with some jQuery magic, but doing so my hurt the database data. Numbers are not evaluated that way typically on the backend. So if you need to do something with this data, it could become a problem.

You can create a second field and make it a calculation and then ask that to be displayed with a thousands separator.

See: https://formidableforms.com/knowledgebase/field-calculations/#kb-currency-calculations

Victor Font answered 2 years ago
You could try this: https://formidable-masterminds.com/formatting-fields-as-currency/. This solution uses an external library. JavaScript also has a built-in Intl.NumberFormat that you can use. You can see a working example here: https://formidable-masterminds.com/display-range-slider-as-currency/. The documentation for the built-in function is here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right