PDF Editing Issues

How to Display a Text Field Value Based on a Checkbox in PDFs

Jason MillerJason Miller Nov 10, 2026 868 views

Question details

The user needs to dynamically display the name of a selected checkbox option in a designated text field elsewhere in the PDF document.

How to Display a Text Field Value Based on a Checkbox Selection in a PDF
Product
PDF
Device & OS
not provided
Scenario
Creating an interactive PDF form where text fields auto-populate based on a user's checkbox selections (e.g., selecting an 'apples' checkbox displays 'apples' in a text field).
Observed behavior
The user wants to link a checkbox selection to a text field so that checking the box runs an action to output a specific text string on another page.
Before you start

Ensure you have a PDF editor that supports interactive form fields and JavaScript, and identify the exact field names of your target checkboxes and text fields.

Solution 1Recommended

Use JavaScript on the Checkbox Mouse Up Action

Assign a custom JavaScript action to the checkbox's Mouse Up event to automatically push the chosen value to the text field.

To make a text field dynamically mirror a checkbox choice, you must assign an export value to the checkbox and use a short script to detect when the box is checked or unchecked. If the box is checked, the script outputs your desired word; if unchecked, it clears the text field.

1
Set the Export Value

Open your PDF form in edit mode. Right-click the checkbox you want to configure, select 'Properties', and navigate to the 'Options' tab. Set the 'Export Value' to the word you want displayed (e.g., 'Oranges').

2
Add a Mouse Up Action

Switch to the 'Actions' tab in the Properties window. Select 'Mouse Up' as the trigger, choose 'Run a JavaScript' from the action dropdown menu, and click 'Add'.

3
Input the JavaScript Code

In the JavaScript editor, enter the following code: this.getField("Text field").value = event.target.value == "Off" ? "" : "Oranges";

4
Customize and Test

Replace 'Text field' with the exact name of your target text field, and 'Oranges' with your desired output. Click 'OK' to save, exit form editing mode, and click the checkbox to test the result.

Handling Multiple Checkboxes: If multiple checkboxes can be selected at once, you will need to define a more complex script to concatenate the values or prioritize which word displays in the text field.
Edit Interactive PDF Forms with WPS Office

Create and Edit Advanced PDF Forms Easily in WPS Office

WPS Office provides a comprehensive suite of PDF tools, allowing you to insert interactive form fields like checkboxes and text boxes, and edit their properties with ease.

  1. 1. Open your PDF: Launch WPS Office and open the PDF document you want to edit.
  2. 2. Access Form Controls: Navigate to the 'Form' tab on the top ribbon to access the interactive form controls.
  3. 3. Insert Form Fields: Select the Checkbox or Text Field tool to draw and add new interactive elements to your document.
  4. 4. Edit Properties: Double-click the newly inserted form fields to modify their properties, field names, and export values.
Easily insert and manage PDF checkboxes, text fields, and dropdowns.High compatibility with standard PDF formats and Adobe Acrobat interactive forms.Lightweight software with an intuitive, user-friendly interface.Seamlessly edit text, images, and form elements directly within your PDF documents.
microsoft office alternative - wps office

Frequently Asked Questions

Can I use the same name for multiple checkboxes?

Yes, giving multiple checkboxes the same name groups them together like radio buttons. However, you must ensure each has a unique export value so the form recognizes which specific option was selected.

Why isn't my text field updating when I click the checkbox?

Ensure that the JavaScript action is set to trigger on 'Mouse Up' rather than 'Mouse Down'. Additionally, verify that the exact name of the target text field matches the field name referenced in your script, as JavaScript is case-sensitive.

How do I clear the text field when the checkbox is unchecked?

The provided script automatically handles this using a conditional statement (event.target.value == 'Off' ? '' : 'Your Value'). When the box is unchecked, its value evaluates to 'Off', which pushes an empty string to clear the text field.