PDF Editing Issues

Create a Checkbox-Based PDF Calculation in Adobe Acrobat

Algirdas JasaitisAlgirdas Jasaitis Nov 19, 2026 868 views

Question details

Calculate a PDF form value only when a checkbox is selected, and return zero otherwise.

Create a Checkbox-Based PDF Calculation in Adobe Acrobat
Product
Adobe Acrobat PDF forms
Device & OS
not provided
Scenario
A PDF form needs a result field whose calculation depends on a checkbox and a numeric input field.
Observed behavior
The result field should display the calculated amount when the checkbox is selected and zero when it is unchecked.
Before you start

Open the form in a version of Adobe Acrobat that supports editing form fields. Identify the exact names of the checkbox, numeric input, and result fields in Prepare a Form.

Solution 1Recommended

Add a custom calculation script to the PDF result field

Use Acrobat JavaScript to check the checkbox state and calculate the result or return zero.

1
Open the form editor

Open the PDF in Adobe Acrobat and select All tools > Prepare a form.

2
Check the field names

Double-click the checkbox and numeric input fields to inspect their names in Properties. Note the exact spelling, including spaces and capitalization.

3
Edit the result calculation

Double-click the result field, open the Calculate tab, select Custom calculation script, and click Edit.

4
Enter the script

Paste: if (this.getField("Check Box36").valueAsString != "Off") { event.value = Number(this.getField("y").value) * 0.38 * 100; } else { event.value = 0; } Replace "Check Box36" and "y" with your field names and adjust the rate and multiplier for your formula.

5
Save and test

Click OK to save the script, close Properties, and save the PDF. Enter a number in the input field, then select and clear the checkbox to verify both results.

Add a custom calculation script to the PDF result field
PDF viewer support: Custom calculations depend on the PDF viewer supporting and allowing Acrobat JavaScript. Test the saved form in the viewer your recipients will use.
Free Microsoft Office alternative

Edit PDF and Office files with WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office files. It can help you move between common document formats, but it does not replace Acrobat's custom form calculation script editor.

Open and work with PDF documents alongside other office filesCompatible with Microsoft Office formats including DOCX and XLSXFamiliar interface for moving from Microsoft OfficeFree, lightweight tools for everyday document work
microsoft office alternative - wps office

Frequently Asked Questions

How does the script tell whether the checkbox is selected?

It checks the checkbox field's valueAsString. An unchecked Acrobat checkbox has the value "Off"; the script calculates when the value is anything else.

Where do I change the calculation rate?

In the result field's Properties, open Calculate > Custom calculation script > Edit. Replace 0.38 and, if necessary, the multiplier 100 with the values required by your formula.

Why does the calculation work in Acrobat but not in another PDF viewer?

Some PDF viewers do not support Acrobat JavaScript or have it disabled. Open the saved form in Acrobat with JavaScript allowed and test it in the intended recipient's viewer.

What should I check if the result does not update correctly?

In Prepare a form, verify that the field names in the script exactly match the checkbox and input field names. Also check that the input is numeric and that the script is attached to the result field's Calculate tab.