How to enable the radio button when the checkbox is tick | XM Community
Skip to main content

How to enable the radio button when the checkbox is tick

  • November 22, 2022
  • 4 replies
  • 435 views

Forum|alt.badge.img+2

Hi Community
I'm trying to working with 2 disabled radio button and enable the two radio button (Yes , No) when the checkbox is being tick,
image.png

4 replies

Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+32
  • Level 8 ●●●●●●●●
  • 633 replies
  • November 22, 2022

Use click event on checkbox element to enable/ disable the last column.


Forum|alt.badge.img+2
  • Author
  • 34 replies
  • November 22, 2022

Hi Shashi, I tried this code however it does disable the radio button but never enable when the i check the checkbox

Qualtrics.SurveyEngine.addOnload(function()
{
//1st rows only
jQuery('input[type="checkbox"]').on("click",function(){
if(jQuery( "[id='QR~QID129#1~1~1']" ).prop('checked')== true)
 {
jQuery('[id="QR~QID129#2~1~1"]').prop("disabled",false);
jQuery('[id="QR~QID129#2~1~2"]').prop("disabled",false);  
 }
else { 
  jQuery('[id="QR~QID129#2~1~1"]').prop("checked",true);
jQuery('[id="QR~QID129#2~1~2"]').prop("checked",true);
}
  });
});
Qualtrics.SurveyEngine.addOnReady(function()
{
//1st rows only
jQuery('input[type="checkbox"]').on("click",function(){
if(jQuery( "[id='QR~QID129#1~1~1']" ).prop('checked')== true)
 {  
jQuery('[id="QR~QID129#2~1~1"]').prop("disabled",false).val('');
jQuery('[id="QR~QID129#2~1~2"]').prop("disabled",false).val('');  
 }
else { 
  jQuery('[id="QR~QID129#2~1~1"]').prop("checked",true);
jQuery('[id="QR~QID129#2~1~2"]').prop("checked",true);
}
  });
});


Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+44
  • 1549 replies
  • November 23, 2022

https://community.qualtrics.com/XMcommunity/discussion/23095/how-to-enable-the-radio-button-when-the-checkbox-is-tickHey ricsdpl
I made a slight adjustment to enable/disable and uncheck the values. Hope this is what is required. It's just for first row.
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
jQuery('[id="QR~QID129#2~1~1"]').prop("disabled",true);


jQuery('[id="QR~QID129#2~1~2"]').prop("disabled",true);

});
Qualtrics.SurveyEngine.addOnReady(function()


{


//1st rows only


jQuery('input[type="checkbox"]').on("click",function(){


if(jQuery( "[id='QR~QID129#1~1~1']" ).prop('checked')== true)


 {


jQuery('[id="QR~QID129#2~1~1"]').prop("disabled",false);


jQuery('[id="QR~QID129#2~1~2"]').prop("disabled",false);  


 }


else { 


jQuery('td.c7>label')[0].className='q-radio';
jQuery('td.c8>label')[0].className='q-radio';
jQuery('[id="QR~QID129#2~1~1"]').prop("disabled",true);


jQuery('[id="QR~QID129#2~1~2"]').prop("disabled",true);
}


  });


});


Hope it helps!


Forum|alt.badge.img+2
  • Author
  • 34 replies
  • November 24, 2022

Thank you Deepak!


Leave a Reply