How to Display a Checkbox Name or Number in a PDF Text Field
Question details
The user needs to display the title or a specific numeric portion of a selected checkbox in a separate PDF text field, while continuing to use the checkbox export values for calculations.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form where text fields need to display customized text or numbers based on which checkboxes are selected by the user.
- Observed behavior
- Instead of relying solely on standard field names, the user wants the text field to output specific formatted results (like "1" or "Y: 1; R: 5") depending on the selected options.
Ensure you are using a PDF editor that supports advanced form creation and JavaScript calculations, such as WPS Office or Adobe Acrobat.
Use a Custom Calculation Script
Write a custom JavaScript in the target text field to inspect the selected checkboxes and output the desired name or number.
To achieve a customized text display while preserving export values for calculation, avoid relying on field names alone.
By assigning a calculation script to the text field, you can accurately determine which checkboxes are toggled and format the output. This approach is highly scalable, even for documents containing hundreds of lines.
Open your document in your PDF editor and enter the Form Editing or Prepare Form mode to access all interactive fields.
Right-click the checkbox, select 'Properties', and navigate to the 'Options' tab. Ensure the 'Export Value' is correctly set for your background calculations.
Create or select the target text field where you want the customized name or number to appear. Right-click the field and open its 'Properties' dialog.
Go to the 'Calculate' tab, choose 'Custom calculation script', and click 'Edit'. Write a JavaScript snippet that checks the value of the checkboxes (e.g., using 'this.getField("Checkbox1").value') and assigns your desired text format to 'event.value'.
Build Interactive PDF Forms with WPS Office
WPS Office provides powerful PDF editing capabilities, allowing you to design, edit, and add interactive form fields like checkboxes and calculated text fields with ease.
- 1. Launch WPS PDF: Open WPS Office and load the PDF document you want to edit.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to view all interactive form controls, including checkboxes and text fields.
- 3. Customize Field Properties: Double-click any form field to open the properties panel, where you can modify export values, appearance, and calculation formulas.
- 4. Save and Test: Exit form editing mode to test your custom scripts, ensuring the text field updates dynamically when checkboxes are selected. Save your changes.

Frequently Asked Questions
Why is my text field not updating when I click a checkbox?
Your form might not be set to calculate automatically. Check your PDF editor's preference settings and ensure that the 'Automatically calculate field values' option is enabled.
What is an export value in a PDF form checkbox?
An export value is the specific underlying data string passed to the form's logic or database when a checkbox is selected. It is primarily used for backend calculations rather than what is visually displayed as the checkbox name.
Can I display both custom text and the calculated result in the same field?
Yes, you can use JavaScript to concatenate strings and calculated variables within your custom script. For example, using 'event.value = "Total: " + calculatedNumber;' will display both the text and the numeric result.
Is it possible to apply this script to hundreds of checkboxes at once?
Yes, standard calculation scripts can utilize loops (like 'for' or 'while' loops) to iterate through similarly named checkbox fields, allowing you to scale the logic efficiently across large documents.




