How to Show a Signature Field After Radio Buttons Are Selected in PDF
Question details
The user wants to reveal a signature field in a PDF form only after specific radio buttons (like a Yes/No option) are selected.

- Product
- Device & OS
- not provided
- Scenario
- Creating interactive PDF forms with conditional logic where a signature block remains hidden until mandatory form fields, including radio buttons, are completed.
- Observed behavior
- The JavaScript correctly checks text fields and dropdowns but fails to recognize the selection state of the Yes/No radio buttons, keeping the signature field hidden.
Before modifying the form's JavaScript, ensure that your Yes/No radio buttons belong to the same group (share the same field name) and have properly assigned export values.
Update JavaScript to Use the Display Property for Radio Groups
Instead of using the `.hidden` property on individual fields, check the radio group's selected value and toggle the `.display` property.
Radio buttons in PDF forms function differently than standard text fields. Treating each button as an independent text field often causes conditional logic to fail. You must evaluate the radio-button group as a single entity and use the display property to show or hide the target signature field.
Open your PDF form in editing mode and locate the JavaScript script that runs the validation check for your fields.
Ensure your radio buttons share the exact same Group Name. Check the properties of the group to confirm that a selected export value (e.g., 'Yes' or 'No') is correctly assigned when an option is chosen.
Locate the lines of code using `.hidden = false;`. Delete these lines, as the hidden property is often unreliable for grouped objects.
Replace the old logic with the `.display` property. For example, insert: `this.getField("Completed By").display = bEmpty ? display.hidden : display.visible;`. This statement correctly evaluates if the required fields are empty and toggles the signature field's visibility.
Save your PDF document, switch to the preview or hand tool mode, and test the form by filling out the text fields and selecting a radio button to confirm the signature field appears.

Easily Manage PDF Forms and Signatures with WPS Office
If you are struggling with complex JavaScript logic for PDF forms, WPS PDF provides a user-friendly interface to create interactive forms, add fillable fields, and securely insert electronic signatures with ease.
- 1. Open the PDF File: Launch WPS Office and open your PDF document using the built-in PDF editor.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to easily insert interactive elements like text fields, checkboxes, and radio buttons.
- 3. Add an Electronic Signature: Go to the 'Fill & Sign' tab, click on 'Sign', and create your electronic signature to place anywhere on the document.
- 4. Save and Share: Save your interactive PDF document. It will remain fully compatible with standard PDF readers.

Frequently Asked Questions
Why doesn't the .hidden property work for my PDF radio buttons?
Radio buttons function as a group rather than independent fields. Instead of using the `.hidden` property, Acrobat JavaScript relies on the `.display` property (using `display.hidden` or `display.visible`) to correctly toggle visibility based on the group's selection state.
How do I correctly group radio buttons in a PDF form?
To group radio buttons, you must assign the exact same Name to each button in their Properties menu. Then, in the Options tab, give each button a unique Export Value (such as 'Yes' or 'No') so the form logic can identify which specific option was selected.
Can I test the PDF form script without closing the editor?
Yes, you can use the JavaScript Console to test scripts in real-time or simply switch from form editing mode to Preview mode (or the Hand Tool) to interact with the radio buttons and verify if the signature field appears as intended.




