Keep an Adobe Acrobat Form Calculation Field Blank When Zero
Question details
Keep a calculated total entry fee field blank when its value is zero so it can be filled in by hand after printing.

- Product
- Adobe Acrobat PDF form
- Device & OS
- not provided
- Scenario
- A cook-off form calculates an entry fee from selected categories and may be printed before any categories are selected.
- Observed behavior
- The Total Entry Fee field displays 0.00 when no category is selected instead of remaining blank.
Open the PDF in Adobe Acrobat and confirm that you can edit the Total Entry Fee form field. Locate the existing calculation script and identify the variable that holds the final total.
Return a Blank Value When the Calculated Total Is Zero
Use this change in the existing custom calculation script to hide zero while retaining nonzero totals.
In Adobe Acrobat, open All tools > Prepare a form, then double-click the Total Entry Fee field.
Select the Calculate tab, choose Custom calculation script, and click Edit. Keep the existing code that calculates the total.
After the code that calculates the total, use this assignment, replacing total with the name of your total variable if needed: if (total == 0) { event.value = ""; } else { event.value = total; }
Click OK to close the script editor and field properties. Test the form with no categories selected and with one or more selected, then use File > Save to save the PDF.

Work With PDFs and Office Files in WPS Office
WPS Office is a free, lightweight alternative for everyday PDF and Office work, with a familiar interface and support for common Microsoft Office formats to make switching easier. The Acrobat JavaScript calculation must still be edited in Adobe Acrobat.

Frequently Asked Questions
Will the field still show a calculated entry fee?
Yes. The script assigns the calculated total to event.value whenever the total is not zero.
Where can I find the calculation script in Acrobat?
Open All tools > Prepare a form, double-click the total field, and select Calculate > Custom calculation script > Edit.
What if my script uses a variable other than total?
In the Custom calculation script editor, replace total in both parts of the condition with the variable that contains your final calculated amount.
Can I write the fee in by hand after printing?
Yes. When the calculated total is zero, the empty field should print without 0.00, leaving space for a handwritten amount. Preview or print a test copy to check the result.




