Replace a PDF Drop-Down Export Value with JavaScript in Adobe Acrobat
Question details
Replace the export value 0 with 10 when a user selects an option in the PDF drop-down field fund1.

- Product
- Adobe Acrobat PDF forms
- Device & OS
- not provided
- Scenario
- A PDF form uses a drop-down field named fund1 with export values that need to be adjusted by JavaScript.
- Observed behavior
- Changing the drop-down from a separate calculation script produces a set-not-possible error.
Open the form in an Acrobat edition that can edit PDF form fields. Check that fund1 has options with export values 0 and 10, and that form calculations are enabled.
Run the replacement script in the drop-down calculation event
Use the field's own calculation event to replace the selected export value without setting the field from a separate calculation script.
In Adobe Acrobat, open the PDF and select All tools > Prepare a form.
Double-click the fund1 drop-down and open the Options tab. Confirm that its options include export values 0 and 10.
In the field properties, open the Calculate tab, select Custom calculation script, and click Edit. Enter: if (event.value == "0") event.value = "10";
Save the form, exit form editing, and select the option whose export value is 0. Verify that the resulting export value is 10. If the change is delayed, check the drop-down's Options tab for Commit selected value immediately and test again.

Work with PDFs and Office documents in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office documents. It supports a smooth move from Microsoft Office, but it does not replace Acrobat's PDF form calculation scripting tools.

Frequently Asked Questions
Why does the separate calculation script produce a set-not-possible error?
The script is attempting to change the drop-down from another field's calculation event. Put the replacement logic in fund1's own Calculate > Custom calculation script and assign the result to event.value instead.
Where can I check a drop-down option's export value?
In Acrobat, choose All tools > Prepare a form, double-click fund1, and open its Options tab. Check the export values assigned to the listed options.
How can I make the value change as soon as an option is selected?
In the drop-down field's Options tab, enable Commit selected value immediately if it is available. Then exit form editing and test the selection to confirm when the calculation runs.
What if I only want to show 10 without changing the drop-down?
Leave fund1 unchanged and add a separate text field in Prepare a form. Use that text field's Calculate tab to calculate the displayed value from fund1.




