How to Fix Acrobat Dropdown Validation Script Using Previous Value
Question details
A custom validation script for a dropdown field evaluates the previously selected item rather than the newly selected value.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating or modifying a custom JavaScript validation script to show or hide fields based on a dropdown selection in a PDF form.
- Observed behavior
- The validation script triggers before Acrobat updates the field, causing the logic to apply to the old selection instead of the new one.
Ensure you have access to edit the PDF form fields and possess basic knowledge of Acrobat JavaScript to modify the custom validation script.
Use event.value in the Custom Validation Script
Modify your JavaScript code to reference the validation event's value directly instead of the field's value property.
During a validation event in Adobe Acrobat, the field's primary value property retains the previous selection until the validation completes successfully. To evaluate the user's newly selected item, you must target the event itself using the event.value property.
Right-click the dropdown field in form editing mode and select Properties from the context menu.
Click on the Validate tab and locate the 'Run custom validation script' section.
Click the Edit button to open the JavaScript Editor window.
Find any code where you reference the field's value (such as this.getField('dropdown').value) and replace it entirely with event.value.
Ensure your switch or if/else statements use event.value to read the newly selected export value, allowing you to correctly trigger actions like showing or hiding corresponding fields.

Create and Manage PDF Forms with WPS Office
WPS Office provides a comprehensive PDF editor that allows you to easily create interactive forms, add dropdowns, and manage form properties without writing complex scripts.
- 1. Open WPS PDF: Launch WPS Office and open your PDF document using the built-in PDF reader.
- 2. Access Form Tools: Navigate to the Form tab on the top ribbon to reveal the interactive form controls.
- 3. Insert a Dropdown: Select the Dropdown tool and click on your document to place the field.
- 4. Edit Field Properties: Double-click the dropdown to seamlessly add list items, manage export values, and customize appearance.

Frequently Asked Questions
Why is my PDF dropdown script not hiding fields correctly?
This usually happens if the script evaluates the old field value instead of the newly selected one. Using event.value in your custom validation script ensures the new selection is captured and evaluated correctly.
What is the difference between event.value and getField().value in Acrobat?
The event.value property refers to the pending value currently being validated or formatted. In contrast, getField().value retrieves the last fully committed value of the field.
Can I use export values in an Acrobat validation script?
Yes, event.value will return the export value of the selected dropdown item. You can use this export value in a switch statement to trigger specific actions like changing field visibility.
In what order do Acrobat form events trigger?
Acrobat processes field events in a specific sequence: Keystroke events trigger first, followed by Validation, Calculation, and finally Formatting events.




