Show an Acrobat Form Alert When a Calculation Is Below a Limit
Question details
Create a dismissible reminder when Total divided by DropFreq is less than 1,000, while allowing the PDF form to be saved.

- Product
- Adobe Acrobat Pro
- Device & OS
- not provided
- Scenario
- A PDF form calculates a ratio from the Total and DropFreq fields and needs to notify the user when the result falls below a limit.
- Observed behavior
- The desired alert should appear for a valid ratio below 1,000 and allow the user to dismiss it and continue saving the form.
Open the PDF in Acrobat Pro and confirm that the form fields are named Total and DropFreq, or adjust those names in the script. JavaScript must be enabled in Acrobat for the calculation and alert to run.
Add a hidden calculation field with an informational alert
Use this method to check the ratio during form recalculation without rejecting the entered values.
The alert is modal while it is displayed, but the user can dismiss it and continue working or saving. It may appear more than once because Acrobat can recalculate fields after other form changes.
Open the PDF in Acrobat Pro, choose All tools > Prepare a form, and add a text field. Give it a distinct name such as RatioCheck.
Open the new field's Properties, select the General tab, and set Form Field to Hidden.
In the field's Properties, open Calculate, select Custom calculation script, and click Edit. Enter the following script: var totalText = String(this.getField("Total").valueAsString).trim(); var freqText = String(this.getField("DropFreq").valueAsString).trim(); var total = Number(totalText); var freq = Number(freqText); event.value = ""; if (totalText !== "" && freqText !== "" && isFinite(total) && isFinite(freq) && freq !== 0) { var ratio = total / freq; event.value = ratio; if (ratio < 1000) { app.alert({ cMsg: "Reminder: Total divided by DropFreq is below 1,000.", cTitle: "Form Reminder", nIcon: 3, nType: 0 }); } }
Close the field properties, preview the form, and enter values that produce a ratio below 1,000. Dismiss the alert, then use File > Save to confirm that the form can be saved. Also test a ratio of 1,000 or more and a zero or blank DropFreq.

Work with PDF forms and Office files in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and compatible Office files. You can move existing documents into WPS, but use Acrobat to create and test the JavaScript alert described above.

Frequently Asked Questions
Will the alert prevent someone from saving the PDF?
No. This script displays an informational alert without rejecting the field values. The user must dismiss the alert before continuing to File > Save.
What happens if DropFreq is blank or zero?
The script leaves the hidden calculation field blank and does not show the reminder. It checks for a blank or zero DropFreq before dividing.
Why does the reminder appear more than once?
Acrobat can run a custom calculation whenever form fields are recalculated. If the ratio remains below 1,000, the condition can trigger another alert.
Will this alert work in every PDF viewer?
Not necessarily. The viewer must support and allow the Acrobat JavaScript used by the form. Test the completed PDF in the viewer your users will use.




