Setting answers for matrix question throwing an error when answer is not first column | XM Community
Question

Setting answers for matrix question throwing an error when answer is not first column

  • 22 April 2019
  • 1 reply
  • 15 views

Userlevel 1
Badge +1
Hi - I have a matrix question that I want to populate with answers using JS code. My code works to set the columns I want to the answers I want. However, when the next button is pressed I get an error "Please answer this question". Interestingly enough I turned off Force Response for the matrix question, and I still get that error.

I can make the error go away by setting the answers for each row in the matrix question to column 1.

Here's my code:

Qualtrics.SurveyEngine.addOnload(function()
{
// this.getQuestionContainer().hide();
var skillsValue = "${q://QID6/SelectedChoicesRecode}";
var passedQ = "${e://Field/passedQuestion}";
// Qualtrics.SurveyEngine.setEmbeddedData( 'skillsSource', skillsValue);
if (skillsValue == "5" && passedQ != "Yes" ) {
var that = this;
that.setChoiceValue("1", "1", true); // set row 1 column 1 to be the answer
that.setChoiceValue("2", "2", true); // set row 2 column 2 to be the answer
that.setChoiceValue("3", "3", true); // set row 3 column 3 to be the answer
}

});

Qualtrics.SurveyEngine.addOnReady(function()
{

});

Qualtrics.SurveyEngine.addOnUnload(function()
{
Qualtrics.SurveyEngine.setEmbeddedData( 'passedQuestion', "Yes" )

});

1 reply

Badge +1
Do you have any validation turned on?

Leave a Reply