PDF Editing Issues

How to Update a PDF Text Field When a Checkbox is Checked

Ayan MasoodAyan Masood Nov 5, 2026 872 views

Question details

The user needs to automatically change the displayed value of a PDF text field based on whether a specific checkbox is selected or cleared.

How to Update a PDF Text Field When a Checkbox is Checked
Product
PDF
Device & OS
not provided
Scenario
Designing an interactive PDF form where a text field's value dynamically responds to checkbox interactions.
Observed behavior
The text field needs to instantly update with a specific numerical or text value upon checking or unchecking the box, without requiring the user to manually click into the text field.
Before you start

Ensure you have a PDF editor that supports form field properties and custom JavaScript actions, and verify the exact names of your target text field and checkbox before proceeding.

Solution 1Recommended

Use a Custom JavaScript Action on the Checkbox

Add a Mouse Up JavaScript action to the checkbox properties to instantly capture its state and write the corresponding value to the target text field.

This method utilizes Acrobat JavaScript to check the event value of the checkbox. By attaching the script to the Mouse Up event, the text field updates immediately as soon as the user releases their mouse click.

1
Open Checkbox Properties

Enter form editing mode in your PDF software, right-click the target checkbox, and select 'Properties' from the context menu.

2
Navigate to the Actions Tab

In the Properties dialog box, go to the 'Actions' tab. Select 'Mouse Up' from the Select Trigger dropdown menu.

3
Add the JavaScript Action

Choose 'Run a JavaScript' from the Select Action dropdown menu, and click the 'Add' button to open the JavaScript Editor.

4
Input the Script

Type the following code: var value = event.target.value; var result = value === "Yes" ? 19.75 : 0.00; this.getField("Member Discount").value = result; (Replace "Yes" with your checkbox's export value, 19.75 with your desired checked value, and "Member Discount" with your actual text field name).

5
Save and Test

Click 'OK' to close the editor, then close the Properties window. Preview your form and click the checkbox to verify that the text field updates automatically.

Use a Custom JavaScript Action on the Checkbox
Verify Export Values: The script uses "Yes" as the default selected state value. You can confirm or change your checkbox's actual export value under the 'Options' tab in its Properties menu.
Advanced PDF Form Editing

Create and Edit Dynamic PDF Forms with WPS Office

WPS Office features a robust PDF editor that allows you to easily insert checkboxes, manage text fields, and handle document properties. It is an excellent tool for creating interactive and professional PDF forms.

  1. 1. Open the PDF Document: Launch WPS Office and open your existing PDF form or create a new blank PDF.
  2. 2. Access Form Controls: Navigate to the 'Form' tab on the top ribbon to reveal the interactive form field tools.
  3. 3. Insert Form Fields: Click on the 'Checkbox' or 'Text Field' icons to place new elements onto your document.
  4. 4. Edit Field Properties: Double-click any inserted form field to open its properties, where you can configure names, export values, and appearance.
Easily insert and align checkboxes, text fields, and dropdown menus.Fully compatible with standard PDF form functionalities and Adobe Acrobat forms.Lightweight interface ensuring smooth performance even with complex documents.Available across multiple platforms for seamless form editing on the go.
microsoft office alternative - wps office

Frequently Asked Questions

Why is the text field not updating when I click the checkbox?

This usually happens if the JavaScript is attached to the wrong trigger or contains a typo. Ensure the script is set to the 'Mouse Up' action and that the exact name of the text field perfectly matches the string inside this.getField().

What is the default export value of a PDF checkbox?

In most PDF editors, the default export value for a checked box is 'Yes', and the unchecked state is 'Off'. You can customize the checked export value in the checkbox properties under the Options tab.

Can I update multiple text fields using the same checkbox?

Yes. You can expand your JavaScript code within the same Mouse Up action to target multiple fields. Simply add additional lines like this.getField("FieldTwo").value = someValue; below your existing code.