Skip to main content
Participant
Apr 18, 2025 2:11 PM UTC
Question

skipping a radio button group based on answer to previous radio button

I have several yes/no radio button groups on a form I've created. If the answer to question one is "yes" then question two is skipped, and you move on to question three. I've tried the suggestions I've found for adding javascript, but I just can't seem to get it right. Any help?

3 replies

try67
Community Expert
Community Expert
Apr 18, 2025 3:26 PM UTC

Place the following code (adjust the field names and values as needed) as the custom calculation script of a (hidden) text field in your file:

 

var radio2 = this.getField("Radio2");
if (this.getField("Radio1").valueAsString=="yes") {
	radio2.readonly = true;
	radio2.value = "Off";
} else radio2.readonly = false;
Translate
Nesa Nurani
Community Expert
Community Expert
Apr 18, 2025 3:19 PM UTC

What do you want to do, skip when tabbing, or make them read only? What script did you try so far?

Translate
Participant
Apr 18, 2025 4:38 PM UTC

When clicking on the "yes" radio button in group 1, I want to be lock group 2 so nothing can be selected.  Right now, I have: 

this.getfield("group2.choice1").readonly=true;
this.getfield("group2.choice2").readoly=true

Translate