PDF Editing Issues

How to Show and Hide PDF Form Fields with Radio Buttons

Olivia MillerOlivia Miller Oct 28, 2026 869 views

Question details

The user needs to set up radio buttons in a PDF form to dynamically show one related text field while hiding other unnecessary fields.

How to Show and Hide PDF Form Fields with Radio Buttons
Product
PDF Forms
Device & OS
not provided
Scenario
Designing an interactive PDF form where field visibility depends on user selection.
Observed behavior
The goal is to use radio button logic to make mutually exclusive choices trigger the display of specific fields without needing separate checkbox deselection scripts.
Before you start

Ensure your PDF editing software supports form creation and JavaScript actions. Take note of the exact names of the text fields you intend to show or hide, as you will need to reference them accurately in your script.

Solution 1Recommended

Configure Mouse Up JavaScript for Radio Buttons

Assign a specific JavaScript action to the Mouse Up trigger of each radio button to control which text fields are visible or hidden.

Because radio buttons provide mutually exclusive choices, selecting one automatically overrides the others within the same group. This makes them perfect for conditionally displaying form fields without requiring complex deselection logic.

1
Access Radio Button Properties

Open your PDF in form editing mode. Right-click the first radio button in your group and select 'Properties'.

2
Set the Action Trigger

Navigate to the 'Actions' tab within the Properties window. Select 'Mouse Up' from the 'Select Trigger' dropdown menu.

3
Add JavaScript Action

Choose 'Run a JavaScript' from the 'Select Action' dropdown menu and click the 'Add' button to open the editor.

4
Enter the Visibility Script

In the JavaScript editor, type the code to show the related field and hide the others. For example: `this.getField("Text1").display = display.visible; this.getField("Text2").display = display.hidden;`.

5
Repeat for Other Buttons

Click 'OK' to save your script. Repeat this process for the remaining radio buttons in the group, ensuring you update the script each time so the correct target field is set to visible and the rest are hidden.

Configure Mouse Up JavaScript for Radio Buttons
Testing Your Form: Exit form editing mode and click through your radio buttons to verify that the correct fields appear and disappear dynamically based on your selections.

Manage Interactive PDF Forms with WPS Office

WPS PDF provides an intuitive and powerful environment for viewing, filling out, and managing interactive PDF forms. Easily handle documents containing dynamic fields and logic.

  1. 1. Download and Install: Get WPS Office from the official website and launch the application on your device.
  2. 2. Open Your PDF: Click on the 'PDF' tab and select your interactive PDF form from your local files.
  3. 3. Interact with Fields: Navigate through the document; WPS PDF will automatically recognize interactive form fields, allowing you to select radio buttons and enter text.
  4. 4. Save and Export: Fill out your required data and securely save or export your completed form for sharing.
Seamlessly interact with dynamic PDF forms and form fieldsFully compatible with standard interactive PDF document formatsLightweight, fast, and easy to navigateComprehensive PDF editing, merging, and secure signing capabilities
microsoft office alternative - wps office

Frequently Asked Questions

Why should I use a 'Mouse Up' trigger instead of 'Mouse Down' for form buttons?

The 'Mouse Up' trigger is standard practice for form buttons because it allows the user to cancel their selection by dragging the cursor away before releasing the mouse button, which helps prevent accidental inputs.

Do I need to write a script to uncheck the other radio buttons?

No. Radio buttons inherently provide mutually exclusive choices when they share the exact same group name in their properties. Selecting one will automatically deselect all others in that group.

What happens if a user prints the PDF with hidden fields?

Fields that are set to 'display.hidden' will not appear on the screen and will also not be printed. Only the currently visible fields associated with the selected radio button will show up on the physical printed copy.