PDF Editing Issues

How to Display an Acrobat Form Alert When a Value Is Above Zero

Rana GarciaRana Garcia Nov 3, 2026 869 views

Question details

The user needs to trigger a pop-up alert message in a PDF form whenever a user inputs a numeric value that is greater than zero.

How to Display an Acrobat Form Alert When a Value Is Above Zero
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Creating or editing a fillable PDF form that requires specific numeric input validation.
Observed behavior
The user wants to apply a custom JavaScript validation rule to evaluate the input and alert the user if the value exceeds zero.
Before you start

Ensure you have Adobe Acrobat Pro or a PDF editor with form-field JavaScript support installed. You will also need to know the specific name of the text field where the validation will be applied.

Solution 1Recommended

Add a Custom Validation Script in Acrobat

Use Acrobat's built-in JavaScript editor to apply a validation rule to the specific form field.

By utilizing Adobe Acrobat's custom validation scripts, you can execute JavaScript code whenever a user updates a field's value. This allows you to check if the input number meets certain conditions before accepting it.

1
Enter Form Editing Mode

Open your PDF document in Adobe Acrobat, go to the Tools menu, and select 'Prepare Form' to enter editing mode.

2
Access Field Properties

Right-click on the specific numeric text field you want to validate and select 'Properties' from the context menu.

3
Navigate to Validation Settings

In the Text Field Properties dialog box, click on the 'Validate' tab.

4
Enter the JavaScript Code

Select the 'Run custom validation script' radio button and click the 'Edit' button. In the JavaScript Editor window, paste the following code: `if (Number(event.value) > 0) app.alert("Enter your message here...", 1);`

5
Customize and Save

Replace 'Enter your message here...' with your desired warning text. Click 'OK' to close the JavaScript Editor, then click 'Close' on the Properties window.

Add a Custom Validation Script in Acrobat
Handling Other Conditions: You can use separate comparisons for different rules. For instance, use `Number(event.value) < 0` if you need to alert users when a value is negative.
All-in-One PDF Editor

Edit and Manage PDF Forms Easily with WPS Office

WPS Office provides a comprehensive PDF toolkit that allows you to easily view, fill, and manage PDF forms. It is lightweight, fully compatible with standard PDF formats, and offers a user-friendly interface for all your document needs.

  1. 1. Install WPS Office: Download and install WPS Office from the official website to access the built-in PDF editor.
  2. 2. Open Your PDF Form: Launch WPS Office and open your interactive PDF form directly within the application.
  3. 3. Fill and Edit: Use the 'Form' or 'Edit' tab to seamlessly fill out fields, add annotations, or modify the PDF content.
  4. 4. Save and Share: Save your completed PDF document, maintaining full formatting compatibility for other users.
Fully compatible with standard PDF forms and Adobe Acrobat filesLightweight and fast PDF viewing, filling, and editingSeamlessly switch between Word, Excel, PowerPoint, and PDF in one appIntuitive interface perfect for managing document workflows
microsoft office alternative - wps office

Frequently Asked Questions

How do I check if a PDF form field value is less than zero instead?

You can modify the custom validation script to use the less-than operator. Open the JavaScript editor for that field and use the code: `if (Number(event.value) < 0) app.alert("Value cannot be negative.", 1);`.

Can I prevent the user from submitting the form if the value is above zero?

Yes. In addition to triggering the alert message, you can reject the input by adding `event.rc = false;` immediately after the alert line in your validation script. This clears the invalid entry and resets the field.

What does the '1' mean in the app.alert function?

The second parameter in the `app.alert(message, type)` function dictates the icon displayed in the pop-up dialog box. A value of '1' displays a Warning icon. Alternatively, '0' displays an Error icon, '2' a Question icon, and '3' an Information icon.

Will this JavaScript alert work in all PDF viewers?

Custom JavaScript validation works reliably in Adobe Acrobat and Adobe Reader. However, some third-party PDF viewers, mobile apps, or browser-based PDF plugins may not fully support JavaScript execution, causing the alert to be ignored.