Copy link to clipboard
Copied
Hello! I am building a form where I have a few number fields where users will input the numbers and then they will be calculated. But, I want to show the numbers like this: 23 444 rather than this: 23,444.
I have tried some script that I found, but can't get it to work. Does anyone have a solution for this? I need both the inputted numbers and the final calculation to be displayed like this.
Thanks.
Copy link to clipboard
Copied
@kathleenm90423663 Yes, it possible please check the link below and let me know if this what you want:
Copy link to clipboard
Copied
I don't understand at all how this video shows me how to solve my problem. All it shows is putting spaces in a number. Am I missing something?
Copy link to clipboard
Copied
In case anyone else is looking for an answer to this, here is what worked for me. I added this to custom format script. This gets rid of 2 decimal places, and replaces the comma with a space.
For inputted fields:
event.value = event.value.replace(",", "."); var x = Number(event.value).toFixed(0);
event.value = x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ").replace(/\./g, ',');
For calculated fields:
var x = Number(event.value).toFixed(0); event.value =
event.value = x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ").replace(/\./g, ',');