How to Disable option 1-3 if Apply to all is selected and disable apply to all if option 1-3 select | XM Community

How to Disable option 1-3 if Apply to all is selected and disable apply to all if option 1-3 select

  • 14 November 2022
  • 3 replies
  • 37 views

Badge +2

Hi Community,
I'm trying to work with disabled option 1-3 if Apply to all is selected and disable apply to all if option 1-3 is selected.
image.png
This is the problem when I can still uncheck/untick option 1-2 even I select the Apply to all.
image.png





3 replies

Userlevel 7
Badge +36

ricsdpl
To uncheck all others you can mark option 1 as exclusive and to disable option1 you can use jQuery. You can also refer this thread which is a bit related.

image.pngHope it helps!

Badge +2

Hi Deepak, I tried to make the "Apply to all" to set as exclusive however when you select it'll selected all but the icon displays as uncheck
Set as Exclusive
image.pngEven I checked the Apply to all it displays as uncheck because it is exclusive
image.png
The jQuery code I used:
jQuery("[id='QR~QID1~1']").click(function(){ //QR~QID1~1 is Appy to all ID
if(jQuery("[id='QR~QID1~1']").prop("checked") == true) {
for(var i=2;i<=4;i++){
jQuery("[id='QR~QID1~"+i+"']").prop('checked', true); //QR~QID1 option loop (option1-3) ID
}
}else{
for(var i=2;i<=4;i++){
jQuery("[id='QR~QID1~"+i+"']").prop('checked', false);
}                          
}
 });

Userlevel 7
Badge +36

ricsdpl
I believe you will have to turn off the exclusive option and make both uncheck and check with JS as it will hinder with your code of checking that along with others.
Also, you need to have click function on the entire QID and not just first option.
Hope it helps!

Leave a Reply