Hello,
For my survey:
Q1 is a Matrix Table Likert "Drag and Drop" question where respondents are shown a list of 20 statements and asked to sort them equally into 2 groups (Group A & Group B).
Q2 is a similar question except it carries forward the statements dropped into Group A, and respondents are asked to further sort those into 2 groups (Group A.1 & Group A.2)
Q3 asked them to do the same thing (Sort carried forward statements from Group B into Group B.1 & Group B.2).
I have managed to do till then. The difficulty I am having is for Q4, where I need to show Groups A.1, A.2, B.1 and B.2 and ask the respondents if they are happy with their groups or if they wish to change. I can't seem to bring forward the selected statements and display them within he correct box as per the image below.
Qualtrics Support told me that I would need to insert a Javascript in order to do this, and I am unsure as to how I should. I will really appreciate it if someone is able to help me with this.
Thank you!
Carry forward response into Drag & Drop box
Best answer by ahmedA
This code should work for you:
Qualtrics.SurveyEngine.addOnReady(function () {
let ques = this;
let a1 = "${q://##QID of A##/ChoiceGroup/SelectedChoicesForAnswer/1}";
let a2 = "${q://##QID of A##/ChoiceGroup/SelectedChoicesForAnswer/2}";
let b1 = "${q://##QID of B##/ChoiceGroup/SelectedChoicesForAnswer/1}";
let b2 = "${q://##QID of B##/ChoiceGroup/SelectedChoicesForAnswer/2}";
let choice_text = ques.getChoiceContainer().innerText.split(/\\n/gm);
let all_choices = ques.getChoices();
let all_answers = ques.getAnswers();
for (let i = 0; i < choice_text.length; i++) {
let set_choice = -1;
switch (true) {
case a1.includes(choice_text[i]):
set_choice = all_answers[0];
break;
case a2.includes(choice_text[i]):
set_choice = all_answers[1];
break;
case b1.includes(choice_text[i]):
set_choice = all_answers[2];
break;
case b2.includes(choice_text[i]):
set_choice = all_answers[3];
break;
}
ques.setChoiceValue(all_choices[i], set_choice, true);
}
});
Points to note:
##QID of A##
and##QID of A##
refer to questions where you are asking them to sort answers in A1, A2 and B1, B2.- Your scale points in this question should be in the order A1, A2, B1, B2. The name doesn't matter.
- Your statements should be all the statements from both the questions. The order doesn't matter.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

Yet when I run it, nothing appears in the groups
Am I doing anything wrong perhaps?