Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

Radio Buttons

Avatar

Level 2

I have the following radio button groups.  They are mutually exlisive so you can select either "10 or Less" (Checkbox1) or "More Than 10" (Checkbox2)  and either Yes or No.  Is there any way to set these up to where only the Yes or No beside either Checkbox1 or Checkbox2 can be selected depending on which is selected?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Put the 10 or Less and More than 10 in one group and the Yes and no on line

one in a second group and the yes and no on line 2 in a 3rd group. Then

you woudl have to write code on the exit event of the 1st group that woudl check which one was selected and sim

ply disable the other group. On teh exit event of the views group you coudl write code like this:

if (this.rawValue == "Value for 10 Views or less"){

     Group2.access = "open";

     Group3.access = "readOnly";

} else {

     Group2.access = "readOnly"

     Group3.access = "open"

}

Note that the default for Group1 and 2 shoudl be readOnly so that the user cannot select an option before chosing a Group 1 value

Make sense?

Paul

View solution in original post

0 Replies

Avatar

Correct answer by
Level 10

Put the 10 or Less and More than 10 in one group and the Yes and no on line

one in a second group and the yes and no on line 2 in a 3rd group. Then

you woudl have to write code on the exit event of the 1st group that woudl check which one was selected and sim

ply disable the other group. On teh exit event of the views group you coudl write code like this:

if (this.rawValue == "Value for 10 Views or less"){

     Group2.access = "open";

     Group3.access = "readOnly";

} else {

     Group2.access = "readOnly"

     Group3.access = "open"

}

Note that the default for Group1 and 2 shoudl be readOnly so that the user cannot select an option before chosing a Group 1 value

Make sense?

Paul

Avatar

Level 2

That works awesome.  Thank you so much.

Avatar

Level 2

I have another question on this issue.  I have the code below which works great however I was wondering if there was a way to clear either RadioButtonList2 or 3.  If you select 10 Views and then select yes or no and change to More than 10 views the yes or no on the 10 views line is still selected (see below).  Is there a way to clear this?

if

(this.rawValue == 1){

 

RadioButtonList2.access

= "open";

 

RadioButtonList3.access

= "readOnly";

 

}

else {

 

RadioButtonList2.access

= "readOnly"

 

RadioButtonList3.access

= "open"

 

}

 

10 Views.jpeg

 

Avatar

Level 10

Sure just set the RadioButtonList rawValue property to "". This will clear the selection.

Paul