Copy link to clipboard
Copied
I am creating calibration certificates, my fields are set as numerical values, but I cannot leave a blank field when data is not available. How can I default the blank fields with "--" using javascript?
Copy link to clipboard
Copied
I would set the field's format to "Custom" and write a custom format script that displays the symbols "--" when empty an the formatted number when number when not blank.
// Custom format field set to format on "Custom";
if(event.value == "")
{
event.value = "--";
} else {
event.value = util.printf("%,2 1.2f", event.value);
}
Copy link to clipboard
Copied
It works!, but some fields have calculations and return 0.00 when data is not filled, so the script does not work in that case.
Copy link to clipboard
Copied
I used the script in a form field that calculated the future value. Note that "" or null string is different from a value of 0.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now