Getting "Sorry, an unexpected error occurred" on the second question that I am trying to hide | XM Community
Skip to main content

errormessage_Qualtrics.pdfI have a survey that passes a store code as a parameter that I capture on an embedded data called 'stid'. I use stid to populate a few questions and hide them using Javascript. Populating them will give me the name (storeid), region (storeidreg) and address of the store (storenameaddr). I also have a few other questions that I populate and hide. The first question that I populate is storeid and this is the code that I use:
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
var StoreVal = "${e://Field/stid}";
this.setChoiceValueByRecodeValue(StoreVal,true);
//Hide the question from respondent view
this.clickNextButton();
});

This is the same code that I use for storeidreg. But when I test the survey, I get the error message and it stops at storeidreg. Even though I have the error, storeidreg was populated properly so I'm thinking it has something to do with the code that hides it. Once I click Next on the storeidreg page, the rest of the questions that I hide using the same code worked.

What do you think causes it? I tried switching storeid and storeidreg and I get the same result. It always stops on the second question.

Have you checked the browser console for errors?
My guess is that you have page transition turned on and you have timing issue clicking the Next button. Either turn page transition off or change addOnload to addOnReady.


I checked page transition and it's off. I also moved the code to addOnReady but I still get the same error.
Thanks for suggesting the browser console. It has something to do with the reCaptcha. When I disabled Bot Detection, it worked. That's weird because I have it enabled on previous surveys that also has the same Javascript code and I didn't encounter the error.


https://www.qualtrics.com/community/discussion/comment/27543#Comment_27543Still using addOnReady, try delaying the next button click:
var qobj = this;
setTimeout(function() { qobj.clickNextButton(); },200); //delay 200ms


rarcega, were you able to solve above mention problem because I am also getting the same problem?

I reached out to support but they also have no idea.

TomG , I tried the way you suggested but page is not advances to next screen automatically rather one has to click on next button to move forward to next question. any suggest to resolve this?


Leave a Reply