PDF Editing Issues

How to Get New Field Values in Acrobat JavaScript Validation Scripts

Jason MillerJason Miller Nov 24, 2026 868 views

Question details

Developers need to retrieve the newly entered data in a PDF form field during validation, but custom scripts return the pre-modified value instead.

How to Get New Field Values in Acrobat JavaScript Validation Scripts
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Writing and executing custom JavaScript validation scripts for interactive PDF form fields.
Observed behavior
Using getField().value inside the validation script retrieves the old, pre-modified value of the field rather than the newly entered data.
Before you start

Ensure you have access to the PDF form's JavaScript editor in Prepare Form mode and basic familiarity with Adobe Acrobat's event model for form fields.

Solution 1Recommended

Use the event.value Property in the Validation Script

Access the newly entered value directly from the event object, which holds the uncommitted input before the validation process completes.

In Adobe Acrobat, a field's value is not officially committed to the document until the validation script runs and approves the input. Because of this, querying the field object directly via this.getField('FieldName').value will return the previous data.

To access the uncommitted, newly entered data being validated, you must use the event object provided by Acrobat's validation trigger.

1
Open Field Properties

Right-click the target form field in Acrobat's Prepare Form mode and select 'Properties'.

2
Navigate to the Validate Tab

Click on the 'Validate' tab where your custom JavaScript validation script is configured.

3
Modify the JavaScript Code

Edit the script to replace instances of this.getField('YourFieldName').value with event.value to capture the new input.

4
Test the Form Validation

Click 'Close' to save the properties, exit form editing mode, and type a new value into the field to verify the script processes the new data correctly.

Use the event.value Property in the Validation Script
Rejecting Invalid Input: If the new event.value does not meet your criteria, you can reject the input by setting event.rc = false; in your script, which reverts the field to its previous value.
Effortless PDF Form Management

Edit and Fill PDF Forms Seamlessly with WPS Office

WPS Office provides a powerful, built-in PDF editor that makes it easy to fill out interactive PDF forms, edit text, and manage your documents safely and efficiently.

  1. 1. Open WPS Office PDF: Launch WPS Office and click on the 'PDF' tab from the home screen to open the PDF module.
  2. 2. Load Your PDF Form: Click 'Open' and select your interactive PDF form document from your local storage.
  3. 3. Fill and Save: Click directly into the interactive form fields to enter your data. Once completed, click the 'Save' icon to retain your form entries securely.
Easily fill, validate, and manage interactive PDF forms without complex scriptingFully compatible with standard PDF formats and Adobe Acrobat formsLightweight, fast, and offers a familiar user interface for seamless document handlingCross-platform support for Windows, Mac, Linux, and mobile devices
microsoft office alternative - wps office

Frequently Asked Questions

Why does getField().value return the old value in a keystroke script?

Similar to validation scripts, keystroke scripts run before the new data is fully committed to the field. You should use event.change to identify the specific character being typed, or event.value to evaluate the uncommitted state.

How can I automatically format a user's input during PDF validation?

If a user enters a value that requires formatting (such as capitalizing all text), you can assign the new formatted string directly to event.value within your custom validation script before it completes.

Does WPS Office support editing PDF forms created in Acrobat?

Yes, WPS Office fully supports opening, viewing, and filling interactive PDF forms created in Adobe Acrobat. It ensures high format compatibility for your daily PDF document processing needs.