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

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

  • September 24, 2020
  • 1 reply
  • 135 views

Forum|alt.badge.img+6
  • Level 2 ●●

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();
}

Best answer by pb7

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();
}


});

1 reply

Forum|alt.badge.img+6
  • Author
  • Level 2 ●●
  • Answer
  • September 24, 2020

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();
}


});