PDF Editing Issues

How to Show a Text Field Value Only When a Checkbox is Selected in PDF Forms

Steven ParkerSteven Parker Nov 5, 2026 869 views

Question details

The user wants to configure a PDF text field to display a specific numerical amount only when an associated checkbox is selected, and remain blank otherwise.

How to Show a Text Field Value Only When a Checkbox is Selected in PDF Forms
Product
PDF Editors
Device & OS
not provided
Scenario
Creating dynamic PDF forms where field values depend on checkbox states for conditional calculations.
Observed behavior
The text field needs to output a specific value (e.g., 15) when the checkbox is checked, remain empty when unchecked, and remain available for further form calculations.
Before you start

Ensure your PDF editing software supports JavaScript for custom field calculations and that you have full form editing permissions for the document.

Solution 1Recommended

Apply a Custom Calculation Script to the Text Field

Use a simple JavaScript condition within the text field's properties to check whether the target checkbox is toggled on or off.

By default, standard calculation options in PDF forms sum up values, but they don't handle conditional display logic. Adding a brief JavaScript statement forces the text field to evaluate the checkbox's state before outputting a number or remaining blank.

1
Open Form Editing Mode

Open your PDF file and enter the form editing or preparation mode provided by your PDF editor.

2
Access Text Field Properties

Right-click the text field where you want the value ($15.00) to appear and select 'Properties' from the context menu.

3
Navigate to the Calculate Tab

In the Text Field Properties dialog box, click on the 'Calculate' tab to view the calculation options.

4
Enter the Custom Script

Select the 'Custom calculation script' option and click the 'Edit' button. Paste the following script: event.value = this.getField("Checkbox1").valueAsString == "Off" ? "" : 15; (replace "Checkbox1" with the exact name of your checkbox).

5
Save and Test

Click 'OK' to save the script, then close the properties window. Switch to Preview or Hand tool mode to test checking and unchecking the box.

Apply a Custom Calculation Script to the Text Field
Calculation Availability: Because the script outputs a real numeric value (15) when checked, other form fields can successfully reference this text field for grand totals or formulas.
Create Dynamic Forms Easily

Easily Create and Manage PDF Forms with WPS Office

WPS Office provides a comprehensive PDF editor equipped with advanced form-building tools. You can effortlessly insert checkboxes, text fields, and apply properties to create professional, interactive forms.

  1. 1. Open PDF in WPS Office: Launch WPS Office and open your target PDF document.
  2. 2. Access Form Tools: Navigate to the 'Form' tab in the top ribbon to view all available form creation tools.
  3. 3. Insert Form Fields: Click on 'Check Box' or 'Text Field' and draw the field on your document page.
  4. 4. Adjust Properties: Double-click the newly inserted field to open the Properties panel, where you can customize its name, appearance, and calculation settings.
Fully compatible with standard PDF forms and Adobe Acrobat interactive fields.Easily insert interactive form controls like checkboxes, text fields, and dropdowns.Lightweight architecture ensures faster performance even when editing large forms.Intuitive user interface that makes finding and adjusting field properties simple.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my text field display a 0 instead of remaining blank?

This usually occurs if you are using a standard mathematical function (like 'Value is the sum of') instead of a custom script. Standard calculations default to 0 for empty values. Ensure you are using the custom JavaScript logic that explicitly sets the value to an empty string ("") when the checkbox is 'Off'.

How do I find the exact name of my checkbox to use in the script?

While in the form editing mode, the field name is typically displayed directly over the field placeholder. You can also right-click the checkbox, select 'Properties', and check the 'Name' text box under the General tab.

Can I format the resulting number as currency?

Yes. After adding your custom calculation script, go to the 'Format' tab in the Text Field Properties, select 'Number' from the category dropdown, choose your desired decimal places, and set the currency symbol (e.g., $). The value 15 will then automatically display as $15.00.