PDF Editing Issues

How to Automatically Fill PDF Text Fields from Selected Check Boxes

Muhammad TalhaMuhammad Talha Nov 5, 2026 868 views

Question details

The user wants to configure a PDF form so that selecting specific check boxes automatically places predefined codes or text into a calculated text field.

How to Automatically Fill PDF Text Fields Based on Check Box Selection
Product
PDF Editor
Device & OS
not provided
Scenario
Creating an interactive PDF form where users select options via check boxes, and a text field dynamically updates to reflect the corresponding values or clears if nothing is checked.
Observed behavior
A custom JavaScript is needed to test the state of each check box and assign values to the text field accordingly.
Before you start

Ensure you are using a PDF editor that supports form field editing and JavaScript calculations. You will need the exact names of your check box fields and target text fields.

Solution 1Recommended

Use an Array Script for Multiple Check Boxes

Best for situations where users can select more than one check box, and you want all selected values to appear in the text field separated by commas.

This approach involves setting an export value for each check box and using an array-based calculation script on the text field to gather all active values.

1
Set check box export values

Right-click each check box and go to 'Properties'. Under the 'Options' tab, enter the code or text you want to appear in the 'Export Value' box.

2
Access text field properties

Right-click the destination text field, select 'Properties', and navigate to the 'Calculate' tab.

3
Add custom calculation script

Choose 'Custom calculation script' and enter the script: var result = []; if (this.getField("Check Box A").value != "Off") result.push("CODE-A"); if (this.getField("Check Box B").value != "Off") result.push("CODE-B"); event.value = result.join(", ");

4
Customize field names

Replace "Check Box A", "Check Box B", and "CODE" strings in the script with the actual field names and export values used in your PDF document.

Use an Array Script for Multiple Check Boxes
Dynamic Updates: Using the array method ensures the text field dynamically updates and clears completely when all check boxes are deselected.
Advanced PDF Form Editor

Easily Manage Interactive PDF Forms with WPS Office

WPS Office features a robust PDF editor that simplifies creating, editing, and filling interactive PDF forms. Whether you need to insert check boxes, manage text fields, or secure your document, WPS Office offers an intuitive interface without the steep learning curve.

  1. 1. Open your PDF: Launch WPS Office and open your PDF document.
  2. 2. Access form tools: Navigate to the 'Form' tab on the top ribbon to reveal interactive elements.
  3. 3. Insert check boxes: Click the 'Check Box' tool and click anywhere on the page to place it.
  4. 4. Edit properties: Double-click the newly created field to adjust its appearance and export values.
Easily insert, edit, and align check boxes and text fields.Fully compatible with standard interactive PDF forms and Adobe Acrobat.Lightweight software with a familiar, user-friendly interface.Comprehensive PDF toolkit including conversion, merging, and signing capabilities.
microsoft office alternative - wps office

Frequently Asked Questions

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

This usually happens if JavaScript is disabled in your PDF viewer's preferences. It can also occur if the field names in your script do not exactly match the actual names of your check boxes and text fields (field names are case-sensitive).

How do I set the export value of a check box?

In form editing mode, right-click the check box and select Properties. Go to the Options tab, and you will see a field labeled 'Export Value'. Type your desired code or text here.

Can I combine multiple check box values into a single text field?

Yes. By using a custom calculation script with an array (e.g., var result = []), you can push the export value of each selected box into the array, and then use result.join(', ') to display them together in one text field.