How to Set Checkbox Values Based on Combo Box Selections in Adobe Acrobat
Question details
The user needs to dynamically calculate total prices in a PDF form using a combination of combo box selections and the on/off status of related checkboxes.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form where package pricing calculates dynamically, relying on both a selected combo box option and whether associated checkboxes are checked.
- Observed behavior
- Setting values in the combo box validation script forces the total price to update incorrectly, adding values even when the related checkboxes are left unchecked.
Ensure you have access to the 'Prepare Form' tools in Adobe Acrobat Pro, as setting up custom JavaScript calculations requires advanced PDF form editing permissions.
Implement Custom JavaScript for the Total Field Calculation
Instead of applying validation scripts to the combo box, apply a custom calculation script directly to the final total field. This ensures the script evaluates both the combo box and checkbox states simultaneously before calculating the price.
Applying a validation script to a combo box only triggers when the combo box itself is modified. If a user subsequently unchecks a box, the combo box validation won't recalculate the total.
To solve this, place the logic within the Total field's calculation events. By checking the 'valueAsString' property of each checkbox, you can verify if a specific box is set to 'Off' and exclude its price accordingly.
Open your PDF document in Adobe Acrobat, navigate to the 'Tools' menu, and select the 'Prepare Form' option to reveal all form fields.
Right-click on the specific text field designated for your final calculated total, and select 'Properties' from the context menu.
In the Properties dialog box, click on the 'Calculate' tab at the top. Select the 'Custom calculation script' radio button.
Click the 'Edit' button. Write a JavaScript snippet that reads the combo box selection. Add conditional 'if' statements to check each corresponding checkbox's 'valueAsString' property. If the value is not equal to 'Off', add the package price to your running total.
Save the script and close the properties window. Exit 'Prepare Form' mode to test your logic by selecting different combo box options and toggling various checkboxes.
Create and Manage Interactive PDF Forms with WPS Office
If you frequently work with interactive PDF documents, WPS Office provides a comprehensive PDF editor that allows you to effortlessly design forms, manage checkboxes, and handle document data in a lightweight, user-friendly environment.
- 1. Open Your PDF: Launch WPS Office and open your PDF document using the integrated WPS PDF tool.
- 2. Enter Form Mode: Navigate to the 'Form' tab on the top ribbon to access the interactive form creation and editing controls.
- 3. Add Form Elements: Click on 'Check Box', 'Combo Box', or 'Text Field' in the toolbar to insert new interactive elements onto your document page.
- 4. Configure Properties: Double-click any inserted form field to adjust its properties, appearance, and export values to suit your data collection needs.

Frequently Asked Questions
Why are my PDF form checkboxes adding values to the total even when they are unchecked?
This usually happens if your calculation script assigns values purely based on the combo box selection without verifying the current state of the checkbox. The script must explicitly check if the checkbox's value is 'Off' before applying its price.
Can I use combo box validation scripts to calculate totals in Acrobat?
While it works for very simple forms, using a combo box validation script to calculate totals involving other fields (like checkboxes) is not recommended. Changing a checkbox state won't trigger the combo box to recalculate, leading to inaccurate totals.
How do I check if a checkbox is selected in an Acrobat calculation script?
You can determine a checkbox's state by targeting the field name in JavaScript and reading its 'valueAsString' property. If the checkbox is unchecked, the property typically returns the string 'Off'.




