Hide next/submit button at end of survey | XM Community
Skip to main content
Hi. I doing a survey and at the end of the survey I would like the next button to show only if the respondents have answered yes to the question "are you satisfied that all applicable questions have been answered" If, they select 'No' I would like a message to be displayed saying "Please ensure that all applicable questions have been answered" and the next button remains disabled (whilst the back button is available). I'm a Qubie 🙂 so any help will be greatly appreciated . Thanks in advance
You can do this using JavaScript. On the last question go to the Advanced Question Options -> Add JavaScript. Delete out all the existing code and add the following:



Note that I'm displaying the message as an alert for simplicity but you could create a custom error message at that point. Hopefully this puts you on the right track.



Qualtrics.SurveyEngine.addOnload(function()

{

/*Place your JavaScript here to run when the page loads*/

//disables the next button on the page

this.disableNextButton();

//question click is a simple onclick handler

//attached to the question's container div

this.questionclick = function(event,element)

{

//by default you get the click event as the first parameter and the clicked element as the second parameter

console.log(event, element);

if (element.type == 'radio')

{

var choiceNum = element.id.split('~')[2];

if (choiceNum == 1)

{

//enables the next button - Note that the QuestionData object is bound to this to make it easier to use

this.enableNextButton();

}

else

{

//alert

alert('Please ensure that all applicable questions have been answered');

//disables the next button

this.disableNextButton();

}

}

}



});



Qualtrics.SurveyEngine.addOnReady(function()

{

/*Place your JavaScript here to run when the page is fully displayed*/



});



Qualtrics.SurveyEngine.addOnUnload(function()

{

/*Place your JavaScript here to run when the page is unloaded*/



});
Thanks a million @GrayMatterThinking. This works fine. Follow-up question... How do I get a message to display if they select the 'no' option? This message will give them further instructions.



Also, is it possible to hide the next button and only show it if two conditions are met.... Condition 1) they select yes that they are satisfied that all questions are answered correctly and condition 2) more than 85% of the survey have been answered?

Leave a Reply