Skip to main content
Participant
February 14, 2024
Question

Ability to select radio buttons based on a check box is selected

  • February 14, 2024
  • 8 replies
  • 1655 views

I am building a form and I would like a group of radio buttons to be available for selection based on whether the leading checkbox is selected.

If Checkbox 1 is selected, then the user could chose one of three following Radio Buttons.

If Checkbox 2 is selected, then the user could chose one of three (different from the first Group) Radio Buttons.

If Checkbox 3 is selected, then the user could chose one of two (different from the first and second Group) of Radio Buttons

 

The Radio buttons should only be able to be selected if the preceeding checkbox is selected.

I am very new to Java Scripts and need HELP!

This topic is closed to new replies. Start a new post to keep the conversation going.

8 replies

Nesa Nurani
Community Expert
Community Expert
February 14, 2024

You can hide the radio buttons you don't want to be selectable by accessing their widget.

Let's say you have 3 radio buttons and name of the group is "Group1", first button would have widget number 0, and you would access it like this ("Group1.0"), second is 1 and 3rd is 2, so let's say you want to hide first two buttons if checkbox is checked, as 'Mouse UP' action of checkbox add this script:

if(event.target.value !== "Off"){
this.getField("Group1.0").display = display.hidden;
this.getField("Group1.1").display = display.hidden;}

Participant
February 14, 2024

Excellent!

How would I reset (unhide) the radio buttons if the user changes their mind - changes their selection of Checkbox?

Nesa Nurani
Community Expert
Community Expert
February 14, 2024

I would suggest you to use custom calculation script in any text field so it can automatically change state of the radio buttons. If you tell me exact names of the checkboxes and radio buttons and all the conditions to show/hide radio buttons, I can help you make that script.