Sometimes you need to show previous responses to participants. Usually, you can use "default values" and set them to some previous answer.
However, that is not an option for matrix questions.
This JavaScript collects the responses from a previous question and dumps them into the current. In this particular application, I had three questions in the matrix, so I'm retrieving three values. Also, I didn't want participants to be able to change their answers, so I'm disabling the question as well.
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
});
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
// Retreive answers from the original question
var choice1 = parseInt("${q://QID1342/SelectedAnswerRecode/1}");
var choice2 = parseInt("${q://QID1342/SelectedAnswerRecode/2}");
var choice3 = parseInt("${q://QID1342/SelectedAnswerRecode/3}");
//Set default choices
this.setChoiceValue(1, choice1 , true);
this.setChoiceValue(2, choice2 , true);
this.setChoiceValue(3, choice3 , true);
//Make this question uncliclable
jQuery("#"+this.questionId+" input[type=radio]").prop("disabled", true);
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
});
To learn more about the Qualtrics setChoiceValue method, go to: https://www.qualtrics.com/wp-content/uploads/2013/05/Qualtrics-Question-API.pdf