Calculate a PDF Form Value from a Drop-Down and Radio Button in Adobe Acrobat
Question details
Calculate a PDF form field value based on a drop-down selection and a radio-button choice.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A PDF form needs to return a price or other value for each combination of two form inputs.
- Observed behavior
- The calculated field should display the value associated with the selected drop-down and radio-button combination.
Open the form in Adobe Acrobat and check the exact field names and export values for the drop-down options and radio buttons. Make sure the output field is a text field that can run a custom calculation script.
Use a custom calculation script to look up each combination
Use this method when each drop-down and radio-button combination has a predefined result.
The example uses a drop-down field named Plan, a radio-button group named Coverage, and a calculated text field named Price. Replace the names, export values, and prices with those from your form.
The script reads valueAsString as a property, combines the two values into a key, and assigns the matching price to event.value. It leaves the result blank when no combination matches.
Open All tools > Prepare a form, then open the properties of the drop-down and radio-button fields. Confirm their field names and option export values; this example expects Plan values Standard and Premium and Coverage values Yes and No.
In Prepare a form, open the Price text field's properties, select the Calculate tab, and choose Custom calculation script. Click Edit.
Paste this script into the JavaScript editor and adjust the names and lookup entries: var plan = this.getField("Plan").valueAsString; var coverage = this.getField("Coverage").valueAsString; var key = plan + "|" + coverage; var options = ["Standard|Yes", "Standard|No", "Premium|Yes", "Premium|No"]; var prices = [120, 100, 220, 200]; event.value = ""; for (var i = 0; i < options.length; i++) { if (key === options[i]) { event.value = prices[i]; break; } }
Click OK to close the script editor and field properties, then use Preview in Prepare a form. Select each drop-down and radio-button combination and confirm that Price displays the intended result.

Work with documents and PDFs in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with Office documents and PDFs. Its format compatibility makes it easy to move existing files into your workflow. Use Adobe Acrobat for the Acrobat-specific form calculation script described above; WPS does not fix or replace that scripting workflow.

Frequently Asked Questions
Where do I enter the Acrobat calculation script?
Open All tools > Prepare a form, open the output text field's properties, and select Calculate > Custom calculation script > Edit.
Why is my calculated field blank?
Check that the field names in this.getField match the form exactly and that each lookup key uses the actual drop-down and radio-button export values. The example also returns a blank if no listed combination matches.
Can I use the visible labels instead of export values?
The script compares the values returned by the fields, which can differ from visible labels. Check the drop-down options and radio-button properties in Prepare a form, then use the returned values in the options array.
How do I add another price combination?
Add a new combined key to the options array and its corresponding result at the same position in the prices array. Test the new selection in Preview.




