How to Keep Adobe Acrobat Calculation Fields Blank Until Input Is Entered
Question details
The user needs a PDF form calculation field to remain completely empty instead of displaying a premature calculation result before all dependent input fields are filled.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Designing an interactive PDF form where a final calculated field depends on user input from multiple preceding fields.
- Observed behavior
- The dependent calculation field displays the value of the first input field (or a zero) before the user has entered any data into the second required input field.
Ensure you are using a PDF editor with advanced form-building capabilities (like Adobe Acrobat Pro) and verify the exact names of the input fields you intend to use in your calculation.
Apply a Custom Calculation JavaScript
By replacing standard field notation with a custom JavaScript snippet, you can instruct the form to verify that input fields are not empty before executing the mathematical operation.
By default, Acrobat treats empty fields as zeros, which causes calculation fields to display results prematurely. A custom script intercepts this behavior, keeping the output cell entirely blank until specific conditions are met.
Launch Adobe Acrobat, open your PDF document, navigate to the 'Tools' menu, and select 'Prepare Form' to enter editing mode.
Locate the calculation field (e.g., the 'Need' field) that you want to keep blank. Right-click on it and choose 'Properties' from the context menu.
Go to the 'Calculate' tab in the Properties dialog box. Select the radio button labeled 'Custom calculation script' and click the 'Edit' button.
Paste the following script into the editor: var requiredValue = this.getField("Required1").valueAsString; var onHandValue = this.getField("OnHand1").valueAsString; if (requiredValue == "" || onHandValue == "") event.value = ""; else event.value = Number(requiredValue) - Number(onHandValue); Ensure you replace 'Required1' and 'OnHand1' with the exact names of your form fields, then click OK.

Manage and Fill Interactive PDF Forms with WPS Office
Looking for a cost-effective way to handle interactive PDF documents? WPS Office provides a lightweight, comprehensive PDF toolkit that lets you seamlessly view, fill, and sign interactive forms without the heavy subscription fees of Adobe Acrobat.
- 1. Install WPS Office: Download and install the free version of WPS Office from the official website.
- 2. Open Your PDF: Launch WPS PDF Reader and open your interactive PDF form.
- 3. Fill the Form: Click directly on the form fields to input your data. Any built-in JavaScript calculations will process automatically as you type.

Frequently Asked Questions
Why does my PDF calculation field show a zero instead of staying blank by default?
Standard PDF calculation settings treat empty input fields as numerical zeros. When the math is calculated automatically, it processes those zeros and immediately displays the result. A custom JavaScript is required to override this behavior and force a blank state.
Can I use this script for adding or multiplying fields?
Yes. You can adapt the provided JavaScript by changing the minus sign (-) in the last line to a plus (+), asterisk (*), or forward slash (/) to perform addition, multiplication, or division respectively, while keeping the blank-check logic intact.
Will these custom JavaScript calculations work on mobile PDF readers?
It depends on the specific mobile application. While desktop versions of Adobe Acrobat and WPS Office fully support JavaScript calculations in forms, many basic mobile PDF viewers disable JavaScript execution for security or performance reasons.




