How to Show Acrobat Calculated Fields Only After Clicking a Button
Question details
The user wants to keep calculated checkbox totals hidden in a PDF form and only make them visible when a specific Calculate button is clicked.

- Product
- PDF Forms / Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form where users select options via checkboxes, but the final calculated totals should not dynamically appear until manually triggered.
- Observed behavior
- By default, PDF calculated fields update dynamically and are visible immediately. The user needs a method to suppress this visibility until a button triggers both the calculation and the display.
Ensure you have full editing permissions for the PDF form and that your PDF editor supports JavaScript actions for interactive form fields.
Use JavaScript to Control Form Field Visibility
Set the initial visibility of your calculated fields to hidden in their properties, then use a custom JavaScript action on a button to calculate and reveal the results.
To achieve this, you need to detach the default dynamic calculation from the text field and handle both the calculation and the visibility state change using a button's Mouse Up event.
Open your PDF form in editing mode. Right-click the calculated text field for your category totals and select 'Properties'. Under the 'General' tab, change the 'Form Field' property from 'Visible' to 'Hidden'.
Ensure each checkbox in your form has a proper export value configured. Right-click each checkbox, go to 'Properties', select the 'Options' tab, and enter the specific numerical value you want it to represent when checked.
Use the form toolbar to insert a 'Button' field into your document. Double-click it to open its properties, and under the 'Options' tab, label it 'Calculate' so users know to click it.
In the Button Properties, navigate to the 'Actions' tab. Choose 'Mouse Up' as the trigger and 'Run a JavaScript' as the action. Click 'Add' and write a script that calculates your totals (e.g., adding checkbox values) and changes the target field's visibility using a command like `this.getField('TotalField').display = display.visible;`.
Go to your PDF editor's form tools and check the 'Calculation Order'. Ensure that if you have multiple dependent calculations, they are processed in the correct sequence before the final visibility script executes.

Create and Manage Interactive PDF Forms with WPS Office
WPS Office provides robust PDF editing capabilities, allowing you to easily design interactive forms, manage form field properties, and utilize advanced features seamlessly without needing expensive software.
- 1. Open your PDF Form: Launch WPS Office and open your existing PDF document or create a new one.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access the interactive field tools.
- 3. Insert and Edit Fields: Insert your desired fields like Checkboxes and Push Buttons. Double-click any field to modify its visibility properties and behavior.
- 4. Save and Test: Save your document to apply the interactive form settings and test the button behavior within the WPS PDF viewer.

Frequently Asked Questions
Why are my calculated fields showing zero before I click the button?
By default, PDF form calculators run immediately when the file is opened and display the initial empty state, which evaluates to zero. Setting the field property to 'Hidden' initially prevents this from being seen by the user.
Can I reset the form and hide the calculated fields again?
Yes. You can add a 'Reset' button to your form. In addition to clearing the standard form data, you can attach a secondary JavaScript action to this button that sets the calculated field's display property back to 'display.hidden'.
Will the JavaScript calculation work on mobile PDF viewers?
Support for JavaScript in PDFs varies widely on mobile devices. While standard desktop applications (like Adobe Acrobat or WPS PDF) support them, many default mobile PDF readers may not execute complex form scripts. It is recommended to test your interactive forms on the target platforms your audience will use.
How do I check the calculation order in my PDF form?
In your PDF form editing mode, look for the 'More' or 'Tools' menu within the form preparation tab. There will be an option named 'Calculation Order' or 'Set Field Calculation Order' where you can drag and drop the fields into the correct processing sequence.




