PDF Editing Issues

Combine Dropdown and Text Field Values in an Acrobat Calculation Script

Bushra ParveenBushra Parveen Nov 19, 2026 868 views

Question details

Create a PDF form calculation that displays text only when a dropdown selection and a text field value match a required combination.

Combine Dropdown and Text Field Values in an Acrobat Calculation Script
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A form author wants a result field to respond to both a dropdown selection and a value entered in another field.
Observed behavior
The result field should display the specified text when both conditions are met and remain blank otherwise.
Before you start

Open the PDF in Acrobat and use Prepare a form to check the exact names of the dropdown, text field, and result field. Check the dropdown option's export value as well, because it may differ from the displayed label.

Solution 1Recommended

Add a custom calculation script to the result field

Use this method to show a result only when both form fields contain the required values.

The example compares the dropdown value with S1418 and the text field value with 7. Replace the field names, comparison values, and result text with those used in your form.

Comparing quoted text such as "study" == "S1418" compares two literal strings, not a field value. Read each field with getField() instead.

1
Open the result field properties

In Acrobat, open Prepare a form, then double-click the text field that should display the result.

2
Open the script editor

In the field properties, select Calculate, choose Custom calculation script, and click Edit.

3
Enter the calculation

Enter this script, replacing Dropdown1, Text1, and Result text as needed: var selection = this.getField("Dropdown1").valueAsString; var entered = this.getField("Text1").valueAsString; if (selection === "S1418" && entered === "7") { event.value = "Result text"; } else { event.value = ""; }

4
Test both conditions

Close the properties and use Preview in Prepare a form. Select the matching dropdown option and enter 7, then change either value to confirm the result clears.

Add a custom calculation script to the result field
Check the dropdown value: If a dropdown item has an export value, compare the script against that value rather than assuming it is the same as the visible label. Field names are case-sensitive.
Free Microsoft Office alternative

Work with PDF Forms and Office Files in WPS Office

WPS Office is a free, lightweight alternative for everyday document work, with a familiar interface and support for common Office formats to make moving files easier. Its PDF tools can help you work with forms, but they do not replace Acrobat's custom calculation scripting.

Open and work with PDF forms alongside other documentsCompatible with Microsoft Word, Excel, and PowerPoint formatsFamiliar interface for everyday office tasksFree and lightweight option for working across document types
QA img-9

Frequently Asked Questions

Why is my comparison always false?

A comparison such as "study" == "S1418" compares literal strings. Use this.getField("Dropdown1").valueAsString to read the actual field value, and replace Dropdown1 with the exact field name.

Why doesn't the dropdown match its visible label?

The option may have an export value that differs from its displayed label. In Prepare a form, open the dropdown's properties and check its options, then compare against the export value in the script.

How do I make the result blank when either value changes?

In the result field's Calculate tab, set event.value to an empty string in the script's else branch. This clears the result whenever the required combination is not present.

Where do I put the calculation script?

Open Prepare a form, double-click the result field, and select Calculate > Custom calculation script > Edit. The script belongs on the field that displays the result, not on either input field.