Add Checkbox Values to a Total Field in Adobe Acrobat
Question details
Calculate a total from the numeric values assigned to eight checkboxes in a PDF form.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A form creator wants a total field to update as users select or clear checkboxes.
- Observed behavior
- The total field should add the values of selected checkboxes and exclude cleared checkboxes.
Open the PDF in an Acrobat edition that supports editing form fields, and make sure you can access Prepare a Form. Decide on a unique name and numeric value for each of the eight checkboxes.
Use a custom calculation script to add checkbox values
Assign numeric export values to the checkboxes, then calculate their sum in a text field.
In Acrobat, open the PDF and select All tools > Prepare a form. In some versions, the entry point is Tools > Prepare Form.
Open each checkbox's Properties and give it a unique name, such as Check1 through Check8. If you use different names, update the script in the calculation step to match.
In each checkbox's Properties, open the Options tab and enter its numeric value in Export Value, such as 10 or 25. A cleared checkbox has the value Off and will not contribute to the total.
In Prepare a form, add a text field for the total or open the Properties of an existing text field. On the Calculate tab, select Custom calculation script and click Edit.
Paste this script in the editor, then save it and close the field properties: var total = 0; for (var i = 1; i <= 8; i++) { var f = this.getField('Check' + i); if (f.value !== 'Off') total += Number(f.value); } event.value = total;
Select Preview in Prepare a form, then select and clear several checkboxes. Confirm that the total changes accordingly, and save the PDF.

Work with PDFs and Office files in WPS Office
WPS Office is a free, lightweight alternative for working with PDFs and Office documents. Its familiar interface and format compatibility make it easy to move between everyday files. Use Acrobat for the custom checkbox calculation described above.

Frequently Asked Questions
Where do I set a checkbox's numeric value in Acrobat?
Open the PDF in Prepare a form, open the checkbox's Properties, and enter a number in Export Value on the Options tab.
Why does the script need unique checkbox names?
The script retrieves each field by name using this.getField. Give the checkboxes distinct names in their Properties and make sure those names match the script.
What happens when a checkbox is cleared?
A cleared checkbox has the value Off. The script checks for Off and excludes that checkbox from the total.
Why is the total not calculating correctly?
In Prepare a form, check that every field name matches the script and that each Export Value is numeric. Then use Preview to test the fields; also check Acrobat's JavaScript preferences if scripts are disabled.




