How to Show a JavaScript Warning for PDF Form Values Over 73
Question details
The user needs to configure a PDF form field to display a custom warning message when a number greater than 73 is entered, while still allowing the value to be accepted.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Designing an interactive PDF form where users need to be cautioned about entering high numbers, but the input should not be strictly blocked by standard validation rules.
- Observed behavior
- Using built-in field validation completely prevents users from entering numbers higher than the set limit, instead of just displaying a cautionary warning.
Ensure you have a PDF editor with advanced form editing capabilities, such as Adobe Acrobat Pro, and that the form field you are modifying is already set up to accept numeric input.
Add a Custom JavaScript Validation Script to the Form Field
By applying a custom JavaScript snippet in the field properties, you can trigger a simple alert box without rejecting the user's input.
Default validation rules in Acrobat restrict input entirely. Using a JavaScript alert bypasses this strict restriction, giving the user a warning message while still retaining the data they typed into the field.
Launch Adobe Acrobat, open your PDF document, and select the 'Prepare Form' tool from the right-hand pane.
Right-click the specific numeric text field you want to modify and choose 'Properties' from the context menu.
In the Text Field Properties dialog box, click on the 'Validate' tab located at the top of the window.
Select the 'Run custom validation script' option and click the 'Edit' button. Paste the following code: if (event.value > 73) { app.alert('Custom message goes here'); }
Click 'OK' to close the JavaScript editor, then click 'Close' on the properties window. Switch to 'Preview' mode and enter a number higher than 73 to verify that the warning alert appears without deleting your input.

Read and Manage PDF Forms with WPS Office
If you frequently work with interactive PDFs, WPS Office provides a powerful, lightweight alternative to Microsoft Office and other expensive software. It offers excellent compatibility for viewing, filling out, and managing PDF forms seamlessly across your devices.

Frequently Asked Questions
Why does the default PDF form validation block my input?
Built-in validation rules in Acrobat strictly enforce data ranges. If a user enters a value outside the defined range, the system rejects it entirely to prevent data errors, which is why a custom JavaScript alert is needed to bypass this blocking behavior while still issuing a warning.
Can I use JavaScript to show warnings for values below a certain number?
Yes, you can easily modify the script's condition. For example, changing the code to 'if (event.value < 10)' will trigger the alert when a user inputs a number lower than 10.
Will JavaScript validations work on all PDF viewers?
Not all PDF viewers support JavaScript execution. While comprehensive editors like Adobe Acrobat and full-featured PDF readers handle JavaScript form validations well, basic browser-based viewers or simple mobile apps might ignore the script.
How do I test if my PDF form validation script is working?
After adding the JavaScript in the field's properties, switch from 'Prepare Form' mode to 'Preview' mode in Acrobat, or save the document and open it in a standard PDF reader. Enter a value greater than your limit to ensure the popup alert appears as expected.




