Calculate PDF Form Fields Using Dropdown Values in Adobe Acrobat Pro
Question details
Calculate a PDF form field by multiplying a numeric Size field by a rate based on the selected Category dropdown option.

- Product
- Adobe Acrobat Pro
- Device & OS
- not provided
- Scenario
- A form creator wants a calculated field to use different multipliers for different Category selections.
- Observed behavior
- The calculated field should display Size multiplied by the rate assigned to the selected Category.
Open the PDF in Adobe Acrobat Pro and confirm that it has a numeric Size field, a Category dropdown, and a separate field for the result. Check the exact field names and dropdown export values in Prepare a form.
Add a Custom Calculation Script to the Result Field
Use this method to calculate the result automatically in an Acrobat PDF form.
In JavaScript, = assigns a value, while === compares values. The category strings in the script must match the dropdown's export values, or its displayed items if no separate export values are set.
Open the PDF in Acrobat Pro, then choose All tools > Prepare a form.
Double-click the field that should display the result, then select the Calculate tab.
Select Custom calculation script and click Edit. Enter: var category = this.getField("Category").value; var size = Number(this.getField("Size").value); if (category === "Small" || category === "Medium") event.value = size * 17; else if (category === "Large" || category === "Low/Zero") event.value = size * 25; else if (category === "Low") event.value = size * 100; else event.value = "";
Click OK, close the field properties, and use Preview in Prepare a form. Enter a Size and select each Category option to check the result, then save the PDF.

Edit Related Documents and Spreadsheets with WPS Office
WPS Office is a free, lightweight alternative for working with documents and spreadsheets in a familiar interface. Its Microsoft Office format compatibility helps you migrate existing files, although it does not fix Acrobat's JavaScript calculation script.

Frequently Asked Questions
Why does my JavaScript condition use the wrong category?
Check that the condition uses === for comparison rather than =, which assigns a value. Also verify the dropdown's export values in its field properties.
Where do I add the calculation script in Acrobat Pro?
Choose All tools > Prepare a form, double-click the result field, and open Calculate > Custom calculation script > Edit.
What rates does the example script use?
Small and Medium use 17, Large and Low/Zero use 25, and Low uses 100. Edit the numbers in the custom calculation script to change the rates.
Why does an empty Size field produce zero?
Number converts an empty value to zero. If you want the result to stay blank, check whether Size is empty before converting it and set event.value to an empty string.




