Copy link to clipboard
Copied
Hello,
I have a field with a custom keystroke:
if( event.willCommit )
{
if(event.value == "")
//if nothing is chosen in box1 then box2 will be cleared
this.getField("Text412").clearItems();
else
SetFieldValues(event.value);
}
I would also like this same field to be formatted with two places after the decimal. I am assuming I would need to add code to the Custome format Format script to accomplish that but I don't know how or what scritp to write. Since I don't know how to write javascript I just search and try to adapt what I find. I found this talking about a custome format script:Archived Forum Answer (2 places after decimal)
So I thought I just needed to add this line
Number(event.value).toFixed(2);
to the custom format script but it doesn't work. Is it because I need to add more to the script? Or is my approach completely wrong anyway? Any guidance would be appreciated!
Thanks!
Ariel
1 Correct answer
Hi,
In the link that you provided there is another link that suggests workarounds and additional options
If you read thorugh it there is a part in which the author suggests moving your script as custom calculation script to actually retain the original value of the field amd then apply the numeric formatting by using the built in formatting that is offered in the Format ta
...Copy link to clipboard
Copied
Hi,
In the link that you provided there is another link that suggests workarounds and additional options
If you read thorugh it there is a part in which the author suggests moving your script as custom calculation script to actually retain the original value of the field amd then apply the numeric formatting by using the built in formatting that is offered in the Format tab for that field.
That is actually the easiest way to accomplish this and there is no need for keystroke .
Copy link to clipboard
Copied
Thank you, I did just that. I moved the script somewhere else, and used the built-in numeric formatting.
Thanks again!
Copy link to clipboard
Copied
You're welcome I'm glad it helped.

