Skip to main content
Known Participant
March 14, 2025
Question

Creating a Button to Flag Required Radio Buttons

  • March 14, 2025
  • 1 reply
  • 2295 views

I am creating a form for a design company; there are several radio buttons that are required for submission. I want to create a button that when clicked, shows nothing if all required radio buttons are selected. If required radio buttons have not been selected, I want a pop up stating "Please select all required radio buttons" to appear. I have searched forums for days and nothing seems to be working properly.

1 reply

Thom Parker
Community Expert
Community Expert
March 14, 2025

Radio button groups (and check boxes) have a value of "Off" when unselected.  For example, if one of the radio button groups is named "Group1", then this code (on a button) could be used to validate a selection.

 

if(this.getField("Group1").value == "Off")

     app.alert("Please select an entry for the Group 1 Radio Buttons");

 

You can read more about radio buttons and checkboxes here:

https://www.pdfscripting.com/public/Checkboxes-and-Radio-Buttons.cfm

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Known Participant
March 14, 2025

That didn't work. The radio grouping is Group3.

 

Known Participant
March 18, 2025

Please ignore the email for now. Lets just get the validation part figured out first.

 


if(this.getField("Group3").value == "Off")
app.alert("Please select an entry for all Radio Buttons");

 

This is what I have and regardless of if the radio button is selected or not, the button doesn't do anything when clicked