Copy link to clipboard
Copied
Hi All,
I'm having a massive problem trying to remove the default "0" from a Javascripted form field. I needed the field to be in the "xx xxx xxx xxx" numerical format, which has been figured out:
var x = Number(event.value).toFixed(0);
event.value =
event.value = " " + x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ").replace(/\./g, ',');
But this unfortunately means that now the field defaults to "0" when opening the file. I've searched the forums and have been unable to come up with any kind of solution that maintains the integrity of the format. If anybody can provide some help it'd be really appreciated, thanks!
Copy link to clipboard
Copied
For a number I use the following Custom Format Script:
if(event.value == o) {
event.value = "";
}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
You are dealing with a string value and not a numeric value.
Try as a custom format script:
var x = Number(event.value).toFixed(0);
if(event.value == 0){
event.value = "";
} else {
event.value = " " + x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ").replace(/\./g, ',');
}
Copy link to clipboard
Copied