PDF Editing Issues

How to Populate an Editable Text Field Based on a Radio Button Selection in PDF

Ayan MasoodAyan Masood Nov 3, 2026 869 views

Question details

The user needs a PDF form to automatically insert a specific message into a text field when a third radio button is selected, while keeping the text field editable and leaving it blank for other selections.

How to Populate an Editable Text Field Based on a Radio Button Selection
Product
PDF Editor
Device & OS
not provided
Scenario
Creating or editing an interactive PDF form with dynamic logic.
Observed behavior
The text field must display a default editable message for a specific radio choice and remain blank for all other radio button choices.
Before you start

Ensure you are using a PDF editor that supports form field creation and custom JavaScript actions. Write down the exact field names for your text field and the export values of your radio buttons before proceeding.

Solution 1Recommended

Use a Mouse Up JavaScript Action on the Radio Buttons

Instead of using a calculation script on the text field (which locks the field from user edits), assign a JavaScript action directly to the radio buttons to update the text field value.

Applying a conditional calculation script directly to a text field can overwrite manual user inputs, rendering the field uneditable. To bypass this, we use an action trigger on the radio buttons themselves. This populates the text field when the button is clicked, but still allows the user to manually edit the text afterwards.

1
Enter form editing mode

Open your PDF document in your PDF editing software and navigate to the Form or Prepare Form tab to reveal all form fields.

2
Configure the target radio button

Right-click the specific radio button (the third option) that should trigger the message, select 'Properties', and navigate to the 'Actions' tab.

3
Add the JavaScript action

Set the 'Select Trigger' to 'Mouse Up', choose 'Run a JavaScript' from the 'Select Action' dropdown, and click 'Add'.

4
Enter the script to populate the field

In the JavaScript editor, input the following code: `this.getField("YourTextFieldName").value = "Your default message";` (replace the field name and message with your actual details), then click OK.

5
Configure the other radio buttons

Repeat the process for the other radio buttons in the group, but use this script to clear the field instead: `this.getField("YourTextFieldName").value = "";`.

Use a Mouse Up JavaScript Action on the Radio Buttons
Field Editability: By attaching the script to the radio button's click event rather than the text field's calculation properties, the populated text behaves like regular user input and remains fully editable.
Professional PDF Form Editor

Easily Create and Edit Interactive PDF Forms with WPS Office

WPS Office provides robust PDF editing capabilities, including the ability to create dynamic forms, add interactive radio buttons, and seamlessly manage text fields.

  1. 1. Open your PDF: Launch WPS Office and open your PDF document.
  2. 2. Access form tools: Navigate to the 'Form' tab to access the form creation and editing tools.
  3. 3. Add interactive fields: Use the 'Radio Button' and 'Text Field' tools to place your elements onto the document.
  4. 4. Edit field properties: Double-click any placed field to easily configure its name, appearance, and export values.
Create and customize interactive PDF forms seamlessly.Highly compatible with Adobe Acrobat PDF formats.Lightweight and user-friendly interface for managing form fields.Free tools for text editing, formatting, and document merging.
microsoft office alternative - wps office

Frequently Asked Questions

Why can't I edit the text field after using a calculation script?

Calculation scripts run continuously and force the text field to match the script's output, preventing manual overrides. To keep the field editable, you must use an event trigger (like 'Mouse Up') on the radio button to push the value to the text field once, rather than continuously calculating it.

Can I populate multiple text fields from one radio button selection?

Yes. You can add multiple lines of code within the radio button's JavaScript action. Simply add another line like `this.getField("SecondFieldName").value = "Another message";` to update several fields simultaneously.

How do I find the exact name of my form fields?

In form editing mode, double-click the form field or right-click and select 'Properties'. The exact name will be listed under the 'General' tab in the 'Name' text box. Field names are case-sensitive.