PDF Editing Issues

How to Hide Zero Values in Calculated PDF Form Fields

Algirdas JasaitisAlgirdas Jasaitis Nov 2, 2026 869 views

Question details

The user needs to make a calculated PDF form field appear blank when its result is zero, ensuring unnecessary zeros do not show on printed forms while retaining the zero value for subsequent calculations.

How to Hide Zero Values in Calculated PDF Form Fields
Product
PDF Editor
Device & OS
not provided
Scenario
Designing an interactive PDF form with calculations, aiming for a clean print output without cluttered zero values.
Observed behavior
The form currently displays a visible '0' when the calculation evaluates to zero, which prints on the page and clutters the document layout.
Before you start

Ensure your form fields are correctly designated as calculated number fields. It is highly recommended to save a backup of your PDF form before applying or editing any JavaScript code.

Solution 1Recommended

Use a Custom Format Script to Hide the Displayed Zero

The most efficient way to hide a zero without deleting it is to apply a Custom Format script. This makes the field visually empty but keeps the underlying value intact for other mathematical formulas.

Applying a custom format script allows you to separate the visual presentation of a form field from its actual calculated data. By only altering the display, dependent form fields won't break.

1
Access field properties

Open your PDF form editor, right-click the calculated field you want to modify (such as the 'Total' field), and select 'Properties' from the context menu.

2
Navigate to custom format

In the Field Properties dialog box, click on the 'Format' tab. From the 'Select format category' dropdown menu, choose 'Custom'.

3
Enter the script

In the 'Custom Format Script' text box, type the following exact code: if (event.value == 0) { event.value = ""; }

4
Test the form

Click 'Close' to save your changes. Enter values into your form to test the calculation. When the result is exactly zero, the field will now appear completely blank.

Use a Custom Format Script to Hide the Displayed Zero
Calculation Integrity: Because this script is applied in the 'Format' tab rather than the 'Calculate' tab, the underlying data remains 0. Any other fields relying on this value will continue to compute correctly.
Edit PDF Forms Easily

Create and Manage PDF Forms with WPS Office

WPS PDF provides a comprehensive set of tools for creating, editing, and managing interactive PDF forms. Whether you need to adjust text fields, checkboxes, or format settings, WPS Office makes professional form handling straightforward and accessible.

  1. 1. Open your PDF: Launch WPS Office and open your interactive PDF form document.
  2. 2. Access form tools: Navigate to the 'Form' tab located on the top navigation ribbon to reveal all form-editing capabilities.
  3. 3. Modify fields: Double-click any text field or number box to open its properties and modify formats or calculations.
  4. 4. Save your document: Once your adjustments are made, save the PDF to preserve all updated form behaviors and properties.
Easily edit PDF form fields, text boxes, and properties.Fully compatible with standard Adobe Acrobat PDF form formats.Lightweight software with an intuitive, user-friendly interface.Seamlessly extract and manage data from completed PDF forms.
microsoft office alternative - wps office

Frequently Asked Questions

Will hiding the zero value break my other formulas?

No. When you use the Custom Format script (event.value = ""), you are only changing how the number is displayed on the screen and in print. The underlying data remains '0', so any dependent mathematical formulas will continue to calculate perfectly.

Why do printed PDF forms display zeros by default?

By default, PDF calculation fields explicitly display their exact numerical value to maintain data accuracy. If a mathematical calculation evaluates to zero, it outputs a '0'. While mathematically correct, this can look cluttered on printed invoices or forms, which is why custom formatting scripts are often used.

Can I apply the formatting script to multiple form fields at once?

You generally need to apply the Custom Format script to each calculated field individually through the Properties menu. However, because the script is identical for every field (if (event.value == 0) { event.value = ""; }), you can easily copy it and paste it into the format tab of each relevant field.