How to Hide Zero Values and Field Highlights in PDF Forms
Question details
The user needs to prevent calculated PDF form fields from showing $0.00 when referenced fields are empty and wants to disable the blue highlight color that appears on fields during viewing or editing.

- Product
- PDF Forms
- Device & OS
- not provided
- Scenario
- Creating or filling out a calculated PDF form where empty inputs result in unwanted zero currency values, accompanied by distracting blue highlights on the form fields.
- Observed behavior
- Calculated fields display $0.00 instead of remaining blank, and the PDF reader applies a persistent blue highlight overlay to all fillable form fields.
Ensure you have editing permissions for the PDF document and are familiar with accessing form field properties to input custom calculation or validation scripts.
Use a Custom Calculation Script to Hide Zero Values
Apply a simple JavaScript logic to your calculated field to return a blank space instead of a zero when the source field is empty.
By default, PDF form calculations treat empty source fields as zero, which formats as $0.00 in currency fields. A custom calculation script overrides this behavior to evaluate if the source field is empty.
Right-click the calculated form field displaying the zero value and select 'Properties'.
In the Properties dialog box, go to the 'Calculate' tab and select the 'Custom calculation script' option.
Click 'Edit' and enter the following script (replace "Text1" with the actual name of your source field): var cal = this.getField("Text1").value; event.value = cal == "" ? "" : cal;
Click 'OK' and close the properties window. The field will now remain blank when the referenced field is empty.

Apply a Custom Validation Script
Use a validation script if you prefer to keep using the built-in calculation options (like sum or product) instead of writing a custom calculation script.
Disable Blue Field Highlights in Preferences
Turn off the default software setting that highlights fillable form fields in blue to improve the form's visual appearance.
Create and Manage Advanced PDF Forms with WPS Office
WPS Office provides a comprehensive PDF editor that lets you easily manage interactive form fields, apply custom calculation scripts to hide zero values, and adjust form aesthetics smoothly without heavy subscription costs.
- 1. Open Your PDF Form: Launch WPS Office and open the PDF document containing your form fields.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access all interactive field customization tools.
- 3. Modify Field Properties: Double-click any calculated field to open its Properties dialog, where you can easily paste custom calculation scripts to hide zero values.

Frequently Asked Questions
Can I hide the blue highlight color for all users viewing my PDF form?
The blue field highlight is typically a user-level preference set within their specific PDF reader software. While you can use document-level JavaScript to toggle the 'app.runtimeHighlight' property when the document opens, it's generally best practice to respect the user's local application settings, as forcing it off may reduce accessibility for some users.
Why does my calculated PDF field show $0.00 by default?
When form fields are formatted as currency or numbers, an empty source field is often treated mathematically as a zero during calculations. Without a specific script instructing the field to remain blank, the PDF reader automatically formats that zero according to your field rules, resulting in $0.00.
Will these JavaScript calculation scripts work in all PDF readers?
Custom calculation and validation scripts work perfectly in fully-featured desktop PDF editors like Adobe Acrobat and WPS Office. However, some basic web browsers, built-in system previewers, or simple mobile PDF viewers do not fully support JavaScript, which may prevent the calculations from running properly.




