How to Change Checkbox Prices Using Acrobat JavaScript in PDF Forms
Question details
The user wants to dynamically adjust a product price from 900 to 650 in a PDF form if any of three specific checkboxes are selected.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form with conditional pricing based on user selections.
- Observed behavior
- The user needs a script to calculate the price conditionally, as relying solely on checkbox appearance does not update the underlying value correctly.
Ensure that all checkboxes in your PDF form have unique field names and specified export values before adding the JavaScript calculation.
Add a Custom Calculation Script to the Price Field
Use a custom JavaScript calculation in the price field to check the status of the related checkboxes and set the price accordingly.
By applying a custom calculation script directly to the price field, the value updates automatically whenever a user interacts with the linked checkboxes. This ensures the underlying data is accurate for any subsequent total calculations.
Open your PDF form in edit mode, right-click the target Price field, and select Properties from the context menu.
In the Properties dialog box, click on the 'Calculate' tab to view calculation options.
Select 'Custom calculation script' and click the 'Edit' button. Enter the following script: var discount = this.getField("A").value !== "Off" || this.getField("B").value !== "Off" || this.getField("C").value !== "Off"; event.value = discount ? 650 : 900;
Replace "A", "B", and "C" in the script with the actual field names of your checkboxes, then click OK to save.

Edit and Fill Interactive PDF Forms with WPS Office
WPS Office provides an excellent suite for filling, signing, and managing interactive PDF forms seamlessly across all your devices, ensuring embedded calculations run smoothly.
- 1. Download WPS Office: Download and install WPS Office from the official website.
- 2. Open the PDF Form: Launch WPS PDF and open your interactive PDF form.
- 3. Fill the Form: Click on the form fields to fill in the required information; calculations will trigger automatically.
- 4. Save and Export: Save your completed form securely or export it as needed.

Frequently Asked Questions
Why is my PDF calculation script not updating the total?
This usually happens if the field calculation order is incorrect. Ensure that the individual price fields are calculated before the grand total field in the form properties.
What is the default export value for unchecked checkboxes in PDFs?
By default, an unchecked checkbox in a PDF form returns the value "Off". You must check against this value in your JavaScript to determine if it is selected.
Can I use this JavaScript logic for dropdown menus instead of checkboxes?
Yes, you can adapt the script by replacing the checkbox field names with your dropdown field names and checking against their specific export values instead of "Off".




