PDF Editing Issues

How to Set a PDF Text Field Value from Checkbox Selections

Adam DavisAdam Davis Nov 5, 2026 869 views

Question details

The user needs a text field in a PDF form to automatically display a specific value or calculated score based on which checkboxes are selected.

How to Set a PDF Text Field Value from Checkbox Selections
Product
PDF
Device & OS
not provided
Scenario
Creating an interactive PDF form that involves automated scoring, where checkbox selections dictate the numeric value displayed in a designated score text field.
Observed behavior
The text field requires a custom calculation script to dynamically listen to the checkbox states and update its own value accordingly.
Before you start

Ensure your PDF editing software supports JavaScript for forms, and double-check the exact field names of your checkboxes before applying any custom scripts.

Solution 1Recommended

Use Grouped Checkboxes with a Custom Script

Best for scenarios where only one checkbox from a group is selected, passing its specific export value to the text field.

By giving multiple checkboxes the identical field name but different export values, they act as a mutually exclusive group. You can then use a simple script in your text field to display the chosen value.

1
Configure Checkbox Properties

Open your PDF form editor, double-click each checkbox to open its Properties, and set the 'Name' field to be exactly the same for all (e.g., 'Check Box'). In the Options tab, give each one a unique Export Value.

2
Open Text Field Properties

Double-click the 'Score' text field, navigate to the Calculate tab, and select 'Custom calculation script'.

3
Input the JavaScript

Enter the following code: if (this.getField("Check Box").value != "Off") event.value = this.getField("Check Box").value; else event.value = "";

4
Test the Form

Save your changes, exit form editing mode, and click the checkboxes to verify that the text field updates automatically.

Use Grouped Checkboxes with a Custom Script
Field Naming Accuracy: Ensure the field name in the script perfectly matches the name of your checkboxes, including spaces and capitalization.
Advanced PDF Form Creation

Easily Create and Edit PDF Forms with WPS Office

WPS Office provides a comprehensive suite of PDF tools, allowing you to easily insert text fields, checkboxes, and interactive elements to build professional forms.

  1. 1. Open PDF in WPS Office: Launch WPS Office and open your PDF document.
  2. 2. Navigate to the Form Tab: Click on the 'Form' tab in the top ribbon to access the interactive form controls.
  3. 3. Insert Form Elements: Click 'Check Box' or 'Text Field' and draw them directly onto your document where needed.
  4. 4. Edit Properties: Double-click the inserted fields to rename them, set default values, or adjust formatting to complete your form.
Easily add, delete, and manage interactive PDF form fieldsHighly compatible with Adobe Acrobat PDF formats and formsLightweight, fast, and features an intuitive user interfaceCross-platform support for Windows, Mac, iOS, and Android
microsoft office alternative - wps office

Frequently Asked Questions

Why is my PDF text field not updating when I click a checkbox?

This usually happens if the form field names in your JavaScript do not exactly match the actual names of the checkboxes, or if your PDF viewer does not have JavaScript enabled. Double-check spelling and capitalization.

What does the "Off" value mean in PDF checkbox scripts?

In standard PDF forms, an unchecked checkbox typically returns an export value of "Off". Checking for this specific string in your script allows the code to easily determine whether a user has selected the box.

Can I assign different point values to different checkboxes?

Yes. Instead of simply counting the boxes, you can assign unique export values (like '10', '15', '20') to each checkbox in their Properties. You would then write a script that adds these specific field values together when they are not 'Off'.

Do these custom calculation scripts work on mobile PDF readers?

Not consistently. While these scripts work perfectly on robust desktop PDF readers, many basic mobile PDF viewers do not fully support JavaScript execution. For forms intended for mobile users, standard uncalculated fields might be more reliable.