How to Limit One Checkbox per Row and Count Selections in PDF Forms
Question details
The user needs to configure a PDF form to restrict checkbox selections to a single choice per row and dynamically calculate the total number of specific selections within a column.

- Product
- Adobe Acrobat / PDF
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF survey or questionnaire where each row represents a question with three mutually exclusive choices, requiring automated tallying for each choice column.
- Observed behavior
- To achieve mutual exclusivity and column counting, the fields need to be properly named and grouped, alongside a custom script for dynamic calculations.
Ensure you have a professional PDF editing application installed that supports advanced form field properties and custom JavaScript execution.
Configure Field Names and Apply Custom JavaScript Calculation
Group checkboxes in the same row by giving them identical field names with unique export values, then use a custom JavaScript loop to calculate the totals per column.
To make checkboxes mutually exclusive (so only one can be checked at a time in a single row), they must share the exact same Field Name but have different Export Values. Once grouped properly, you can write a short calculation script in a separate text field to count how many times a specific Export Value was selected.
Open the form editor mode. Right-click the first checkbox in row 1, select Properties, and set the Name to 'Q1'. Do the exact same for the other two checkboxes in that specific row so they all share the 'Q1' name.
Still in the Properties menu for the 'Q1' checkboxes, navigate to the Options tab. Assign a unique Export Value for each column's choice, such as 'Delivered', 'Developed', and 'Not Implemented'.
Add a new Text Field at the bottom of your 'Delivered' column. Name it something like 'Total_Delivered'. Right-click this text field and select Properties.
Go to the Calculate tab in the Text Field properties. Select 'Custom calculation script' and click Edit. Enter the following code to count the 'Delivered' selections for 24 rows: var total = 0; for (var i = 1; i <= 24; i++) { if (this.getField('Q' + i).valueAsString == 'Delivered') total++; } event.value = total;
Create similar Text Fields at the bottom of the other columns. Paste the same JavaScript code into their custom calculation sections, ensuring you change the target string from 'Delivered' to 'Developed' or 'Not Implemented' to match their respective export values.

Easily Create and Manage PDF Forms with WPS Office
WPS Office provides robust PDF editing capabilities, allowing you to easily insert interactive form elements, manage field properties, and design professional forms without needing heavy or expensive software.
- 1. Open your PDF: Launch WPS Office and open the PDF document you want to convert into an interactive form.
- 2. Access the Form tools: Navigate to the 'Form' tab on the top ribbon to reveal the interactive form controls.
- 3. Add checkboxes: Click the 'Checkbox' icon and click anywhere on your document to place the interactive field.
- 4. Modify field properties: Double-click the inserted checkbox to adjust its name, export values, and formatting styles.

Frequently Asked Questions
Why do my checkboxes allow multiple selections in the same row?
This happens when the checkboxes have different Field Names. To make them act like mutually exclusive options, you must assign the exact same Field Name to all checkboxes in that specific row, while giving each a unique Export Value.
Can I use radio buttons instead of checkboxes for this task?
Yes, radio buttons are specifically designed for mutually exclusive selections. You can use them instead of checkboxes by assigning the same group name per row. The JavaScript calculation process remains exactly the same.
Why isn't my total count updating automatically when I click a checkbox?
If the calculation does not update automatically, ensure that JavaScript is enabled in your PDF viewer's security preferences. Additionally, verify that the 'Calculate' order in your form properties is configured correctly if you have multiple dependent calculation fields.




