PDF Editing Issues

How to Calculate 100 Percent Total from Checkboxes in Acrobat PDF

Ayan MasoodAyan Masood Nov 3, 2026 868 views

Question details

The user needs to configure a 'Total' text field in a PDF form to calculate and display a percentage based on the number of selected checkboxes out of a total of 17.

How to Calculate a 100% Total from PDF Form Checkboxes
Product
Adobe Acrobat PDF
Device & OS
not provided
Scenario
Creating an interactive PDF form where checking boxes automatically contributes to a percentage score, reaching 100% when all 17 specific checkboxes are selected.
Observed behavior
The form requires a programmatic rule or script to read the true/false states of 'Check Box1' through 'Check Box17' and output their selected ratio into a designated total field.
Before you start

Ensure all 17 checkboxes are correctly named with a consistent pattern (e.g., Check Box1 to Check Box17) and that you have inserted a designated Text Field ready to act as the Total box.

Solution 1Recommended

Add a Custom JavaScript Calculation to the Total Field

Use a custom script in the Text Field properties to loop through the checkboxes, count the selected ones, and calculate the final percentage.

PDF forms rely on JavaScript for complex custom calculations. By writing a short loop, you can count how many checkboxes are ticked and divide by the total number of checkboxes to get your percentage.

1
Open Text Field Properties

Enter form editing mode in your PDF editor. Right-click the 'Total' text field you created and select 'Properties' from the context menu.

2
Navigate to Calculate Tab

In the Properties dialog box, click on the 'Calculate' tab. Choose the 'Custom calculation script' option and click the 'Edit' button.

3
Enter the Calculation Script

Input a JavaScript loop that iterates 17 times. Use the 'this.getField()' method to check the value of 'Check Box1' through 'Check Box17'. If a box is selected (not equal to 'Off'), increment a counter variable.

4
Calculate the Percentage

Divide your counter variable by 17 (the total number of checkboxes) and multiply by 100 to get the percentage value. Assign this final number to 'event.value' so it displays in the Total field.

5
Set the Field to Read-Only

Switch to the 'General' tab in the Properties dialog box and check the 'Read-Only' box. This ensures users cannot manually overwrite the automatically calculated percentage.

Naming Conventions: Make sure your loop string matches the exact naming convention of your checkboxes, including spaces. If your fields are named differently, the script will fail to locate and count them.
Create Interactive PDF Forms with WPS PDF

Easily Build and Manage PDF Form Calculations in WPS Office

WPS PDF provides a comprehensive set of form building tools, allowing you to easily add checkboxes, text fields, and custom JavaScript calculations to create interactive and smart documents.

  1. 1. Open the PDF in WPS Office: Launch WPS Office and open your PDF document. Navigate to the 'Form' tab to access the form creation tools.
  2. 2. Add Checkboxes: Use the 'Check Box' tool to insert your 17 checkboxes onto the page. Double-click each one to name them sequentially.
  3. 3. Insert the Total Field: Click on 'Text Field' to insert a box for your total. Right-click it, select 'Properties', and navigate to the 'Calculate' tab.
  4. 4. Apply Custom Script: Choose the custom calculation option, paste your JavaScript to automate the percentage calculation, and save your dynamic PDF form.
Supports custom JavaScript for complex form calculationsSeamlessly edit, combine, and secure interactive PDF documentsFully compatible with standard PDF forms and Adobe Acrobat featuresIntuitive interface for drag-and-drop form field creation
microsoft office alternative - wps office

Frequently Asked Questions

Why is my PDF calculation field showing a blank or incorrect value?

This usually happens if the field names referenced in your custom calculation script do not perfectly match the actual names of the checkboxes on the form, or if there is a syntax error in your JavaScript code.

Can I format the output to show the '%' symbol automatically?

Yes. In the Total field's properties, under the Format tab, you can select 'Percentage' as the format category. This automatically multiplies your decimal result by 100 and appends the '%' sign, which allows you to remove the '* 100' step from your custom script.

Does this custom calculation script work on mobile PDF readers?

Custom JavaScript calculations in PDFs are fully supported on robust desktop PDF editors. However, many basic or default mobile PDF viewers do not support JavaScript, which may prevent the calculation from updating when viewed on a smartphone.