Allow Zero Values in Adobe Acrobat PDF Form Validation
Question details
The user needs PDF form validation to accept zero and avoid repeated error messages during field navigation.

- Product
- Adobe Acrobat PDF forms
- Device & OS
- not provided
- Scenario
- A PDF form checks required fields such as Account Number and Policy Number as users enter data and navigate between fields.
- Observed behavior
- An error appears when a field contains zero or multiple zeros, and validation alerts can repeat when users tab through fields.
Open the form in Adobe Acrobat and choose Tools > Prepare Form. Confirm the exact field names and locate any existing validation scripts on the fields and buttons.
Check the field's string value from a form button
Use a button-based check to accept zero and show a required-field alert only when the user activates the button.
In Tools > Prepare Form, right-click the form's submit or validation button and select Properties.
On the Actions tab, select Mouse Up as the trigger and Run a JavaScript as the action, then click Add.
Enter: var field = this.getField("Account Number"); if (field.valueAsString === "") { app.alert("Account Number is required!"); field.setFocus(); } Replace Account Number with the exact field name if yours differs.
Inspect the field's Properties > Validate tab and other button actions. Remove or revise duplicate required-field alerts so the same check does not run again during tab navigation.
Save the PDF and test the button with a blank field, 0, and multiple zeros. Tab through the fields to confirm that the alert does not repeat.

Work with PDFs and Office files in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface for opening PDFs and working with Office documents. It supports a smooth move between common file formats, but it does not fix Adobe Acrobat validation scripts; PDF form JavaScript support can vary by viewer.

Frequently Asked Questions
Why does my PDF form reject zero as an empty value?
A script that checks a value by whether it is true or false can treat numeric 0 as false. Compare the field's valueAsString property with an empty string instead.
Will the empty-string check also accept multiple zeros?
Yes. A field containing 00 or another sequence of zeros is not empty, so it passes the empty-string check. Test the field's formatting and other validation rules separately.
How can I stop the same alert from appearing when I tab between fields?
In Acrobat's Prepare Form tool, inspect each field's Properties > Validate tab and the button's Actions tab. Remove duplicate checks and place the required-field alert on the intended button action if you want it to run only when that button is activated.
Does this script make the field accept numbers only?
No. Checking valueAsString against an empty string only tests whether an entry is present. Use a separate format or validation rule if the field must contain only digits.




