PDF Editing Issues

Make a Calculated Adobe Acrobat Form Field Blank When Its Value Is Zero

Tauseeq MagsiTauseeq Magsi Nov 19, 2026 869 views

Question details

The user wants a calculated PDF form field to appear blank when its result is zero.

Make a Calculated Adobe Acrobat Form Field Blank When Its Value Is Zero
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A calculated form field should show a value only when the calculation result is not zero.
Observed behavior
A script using event.item produces an error instead of replacing the zero result with a blank value.
Before you start

Open the PDF in Adobe Acrobat and identify the calculated field and the source fields it uses. Make sure the field uses a custom calculation script, or locate the existing calculation before editing it.

Solution 1Recommended

Use event.value in the field's calculation script

Add a zero check after the calculation so the field displays an empty value when the result is zero.

1
Open the form editor

Open the PDF in Adobe Acrobat and select Prepare a form from the tools.

2
Edit the calculated field

Double-click the calculated field, open the Calculate tab, and select Custom calculation script. Click Edit.

3
Add the zero check

Keep the existing calculation and add this line after it assigns the result to event.value: if (event.value == 0) event.value = ""; Do not use event.item for the current field value.

4
Check and test the script

Check the complete script for balanced parentheses and braces, then confirm the dialog. Close form editing and change a source field to test both zero and nonzero results.

Use event.value in the field's calculation script
Keep the calculation: The zero check must run after the calculation has set event.value. Replacing the entire calculation with the check alone will not calculate a new result.
Free Microsoft Office alternative

Work with PDFs and Office files in WPS Office

WPS Office is a free, lightweight Office alternative with a familiar interface and support for common file formats, making it easy to move between Office documents and PDFs. It does not fix Acrobat JavaScript errors, and some PDF features may require a subscription.

Open and review PDF documents alongside other office filesCompatible with Microsoft Word DOCX, Excel XLSX, and PowerPoint PPTX formatsUse a familiar interface for a smoother move from Microsoft OfficeAccess free core office tools in a lightweight suite
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't event.item work in my Acrobat script?

Acrobat JavaScript does not use event.item for the current field value. In a custom calculation script, use event.value to read or set the calculated result.

Where should I add the zero check?

In Prepare a form, open the field's properties, select Calculate, and edit its custom calculation script. Add the check after the existing calculation assigns a result to event.value.

Will the field still display nonzero results?

Yes. The line if (event.value == 0) event.value = ""; changes the value only when it compares equal to zero. Test the form with both zero and nonzero source values.

What if the script still reports a syntax error?

Reopen the custom calculation script and check the entire script for missing or extra parentheses, braces, and quotation marks. The line containing event.item may not be the only part that needs correction.