PDF Editing Issues

Calculate Checkbox Values and Change Field Colors in Adobe Acrobat Forms

Steven ParkerSteven Parker Nov 18, 2026 868 views

Question details

Create an Acrobat form where checkbox selections determine another field's value and background color, and a separate field totals selected values.

Calculate Checkbox Values and Change Field Colors in Adobe Acrobat Forms
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A PDF form needs to calculate a value and display a color based on checkbox selections.
Observed behavior
Selecting a checkbox should set a calculated field's value and fill color; another field should sum the required fields.
Before you start

Open the PDF in a version of Adobe Acrobat that supports editing forms, and make sure the checkboxes and calculated fields have unique names. This example uses checkboxes A, B, and C, a calculated text field D, and a total field E.

Solution 1Recommended

Add a custom calculation script to the Acrobat form

Use this method to set field D's value and background color from three checkboxes, then configure field E to calculate a total.

The script checks A first, then B, then C. If more than one checkbox is selected, the first checked field in that order determines the result.

1
Open the form editor

Open the PDF in Adobe Acrobat and select All tools > Prepare a form. Create or identify checkboxes A, B, and C and text fields D and E.

2
Add the calculation script

In Prepare a form, open field D's Properties, select the Calculate tab, choose Custom calculation script, and select Edit. Enter: if (this.getField("A").valueAsString != "Off") { event.value = 10; event.target.fillColor = color.red; } else if (this.getField("B").valueAsString != "Off") { event.value = 25; event.target.fillColor = color.yellow; } else if (this.getField("C").valueAsString != "Off") { event.value = 50; event.target.fillColor = color.green; } else { event.value = ""; event.target.fillColor = color.transparent; }

3
Match the field names

In the script editor, replace A, B, and C with the exact names of your checkbox fields if they differ. Save the script and close field D's Properties.

4
Set up the total

Open field E's Properties and select Calculate. Choose Value is the and select Sum, then use Pick to select D and any other fields to include. Do not include E itself.

5
Test the form

Preview the form in Acrobat and select and clear each checkbox. Confirm that D displays the expected value and color and that E updates its total. Save the PDF.

Add a custom calculation script to the Acrobat form
Check calculation support: The PDF viewer must support Acrobat form JavaScript for the custom calculation and color changes to work. If totals do not update as expected, check the form's field calculation order and ensure D is calculated before E.
Free Microsoft Office alternative

Manage Related Form Data in WPS Office

WPS Office is a free, lightweight Office alternative with a familiar interface and Microsoft Office format compatibility for moving related documents and spreadsheets. It does not replace Adobe Acrobat for creating or running the custom PDF form script described above.

Organize related checkbox values and totals in WPS SpreadsheetsOpen and edit Microsoft Excel XLSX files for easier migrationWork with Word DOCX and PowerPoint PPTX formatsUse a familiar, easy-to-navigate office interface
microsoft office alternative - wps office

Frequently Asked Questions

What happens if more than one checkbox is selected?

The script uses the first selected checkbox in its order: A, then B, then C. If only one choice should be allowed, consider using a radio button group instead.

How do I change the values or colors?

In Acrobat's Prepare a form tool, open field D's Properties > Calculate and edit the custom calculation script. Change the numbers assigned to event.value or the colors assigned to event.target.fillColor.

Why is the total field not updating correctly?

In field E's Properties > Calculate, check that Sum includes the intended fields and excludes E. Also check the field calculation order so that D is calculated before E.

Will the calculation work in every PDF viewer?

Not necessarily. The custom calculation and color changes require a viewer that supports Acrobat form JavaScript. Test the saved PDF in the viewer your recipients will use.