PDF Editing Issues

How to Show a JavaScript Warning for PDF Form Values Over 73

Huma Ashraf ChHuma Ashraf Ch Nov 5, 2026 869 views

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.

How to Show a JavaScript Warning for PDF Form Values Over 73
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.
Before you start

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.

Solution 1Recommended

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.

1
Open Prepare Form Mode

Launch Adobe Acrobat, open your PDF document, and select the 'Prepare Form' tool from the right-hand pane.

2
Access Field Properties

Right-click the specific numeric text field you want to modify and choose 'Properties' from the context menu.

3
Navigate to the Validate Tab

In the Text Field Properties dialog box, click on the 'Validate' tab located at the top of the window.

4
Enter the Custom Script

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'); }

5
Save and Test

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.

Add a Custom JavaScript Validation Script to the Form Field
Customize Your Alert Message: Be sure to replace 'Custom message goes here' in the script with the actual warning text you want to display to your users.
Free Microsoft Office alternative

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.

Fully compatible with standard PDF forms and Microsoft Office document formatsLightweight application that runs smoothly and quickly on most devicesIntuitive interface for filling out form data and editing document textCost-effective, free alternative for handling everyday document tasks
microsoft office alternative - wps office

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.