check whether any option of a multiple choice question has been selected before page submit | XM Community
Solved

check whether any option of a multiple choice question has been selected before page submit

  • 24 September 2020
  • 1 reply
  • 86 views

Userlevel 2
Badge +6
  • Level 2 ●●
  • 11 replies

HI!
I am trying to implement a 'custom' force response. I want to know whether any option on the mcq has been selected before they submit the page. I have put together a code using different threads in this forum, but alas can't get it t work. Any obvious mistakes in my code? There are 4 choices for the mcq.
jQuery('#CustomNextButton').on('click', function() {
var ures =this.getChoiceValue
Qualtrics.SurveyEngine.setEmbeddedData("ures", ures);

if (ures =="") {
  jQuery("#QID7").show();
} else {
  jQuery('#NextButton').click();
}

icon

Best answer by pb7 24 September 2020, 21:07

View original

1 reply

Userlevel 2
Badge +6

Hello, I just figured out my mistake!
Here is the code if anyone needs it in the future

jQuery('#CustomNextButton').on('click', function() {

if(jQuery("#QID4 input.radio").is(":checked")){

jQuery('#NextButton').click();
} else {
jQuery("#QID7").show();
}


});

Leave a Reply