PDF Editing Issues

Calculate PDF Form Totals from Radio Button Selections in Adobe Acrobat

Phi Hung VoPhi Hung Vo Nov 25, 2026 868 views

Question details

Calculate separate PDF form totals based on Choice 1 and Choice 2 selections across 15 radio button questions.

Calculate PDF Form Totals from Radio Button Selections in Adobe Acrobat
Product
Adobe Acrobat PDF forms
Device & OS
not provided
Scenario
A form contains 15 radio button groups and needs a separate calculated total for each choice.
Observed behavior
The desired result is for each total field to update according to the selected radio button values.
Before you start

In Acrobat's Prepare a form tool, check the names of the 15 radio button groups and the export values assigned to each option. The example below assumes group names Q1 through Q15 and export values Choice1 and Choice2.

Solution 1Recommended

Count each radio button choice with Acrobat JavaScript

Use a custom calculation script in each total field to count the selections for its corresponding choice.

The script reads each radio button group's export value, not necessarily the visible label. Unselected groups are ignored.

The example calculates counts. If each selection has a monetary value, multiply the count by that value; if values vary by question, use a per-question amount instead.

1
Open the form editor

Open the PDF in Adobe Acrobat and select All tools > Prepare a form. Confirm that the radio button groups are named Q1 through Q15 and that their option export values are Choice1 and Choice2.

2
Add the first total script

Open the Properties of the Choice 1 total text field. On the Calculate tab, select Custom calculation script, click Edit, and enter: var count = 0; for (var i = 1; i <= 15; i++) { var field = this.getField("Q" + i); if (field && field.valueAsString === "Choice1") count++; } event.value = count;

3
Add the second total script

Open the Choice 2 total field's Properties > Calculate > Custom calculation script > Edit. Use the same script, but replace "Choice1" with "Choice2", then save the script.

4
Test the calculations

Close the form editor or select Preview, then select different options in the radio button groups. Check that each total matches its selection count and save the PDF.

Count each radio button choice with Acrobat JavaScript
PDF viewer support: Custom calculations require a PDF viewer that supports Acrobat JavaScript. If totals do not update, test the form in Acrobat or Acrobat Reader and check that JavaScript and automatic form calculations are enabled in Preferences.
Free Microsoft Office alternative

Use WPS Office for everyday PDF and document work

WPS Office is a free, lightweight Office alternative with a familiar interface and Microsoft Office format compatibility for easier migration. Use its PDF tools for everyday document work; the Acrobat JavaScript calculation above should be created and tested in a compatible Acrobat viewer.

Work with PDFs alongside documents and spreadsheets in one application.Open and edit compatible Microsoft Word, Excel, and PowerPoint formats.Navigate a familiar interface when moving from Microsoft Office.Use a free, lightweight suite for everyday office tasks.
microsoft office alternative - wps office

Frequently Asked Questions

Why does the script use Choice1 instead of the visible radio button label?

Acrobat JavaScript reads the radio button's export value. In Prepare a form, open the radio button's Properties and check its Options tab; change the script to match the actual export value.

How do I calculate an amount instead of a count?

In the total field's custom calculation script, replace event.value = count with event.value = count * 10, using the amount assigned to each selection. For different amounts per question, add the appropriate amount inside the loop instead of incrementing count.

What if my radio button groups have different names?

The example looks for Q1 through Q15 using this.getField("Q" + i). Rename the groups in Prepare a form or revise the script to reference your existing field names.

Why do the totals not update in my PDF viewer?

Some PDF viewers do not support Acrobat JavaScript. Test the form in Acrobat or Acrobat Reader, and check Preferences for JavaScript and automatic form calculation settings.