I would appreciate any help in creating a conditional loop in Qualtrics.
Here is what I am trying to do:
I have a block of 40 questions, which I would like to present to participants randomly.
I would like to repeat the presentation of this block until participants get 25 questions right. In this case, participants will progress in the next block.
many thanks in advance
Initialize correctCount to 0 in the survey flow before the block. Then add JS something like this to each question:
```
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
var correctChoice = "2" //change to match correct choice id
if(correctChoice == this.getSelectedChoices()) {
Qualtrics.SurveyEngine.setEmbeddedData("correctCount",parseInt("${e://Field/correctCount}")+1);
}
});
```
Hi TomG,
I am attempting something very similar to this in a quiz I am designing. However, I am a complete newbie to Qualtrics and Javascript and I need further guidance!
Basically, I have outlined a scenario and follow it with five different multiple choice questions, each with four potential answers. I do not want the participants to move onto the next block unless all five questions are answered correctly (i.e. the correctCount = 5).
Could you please tell me how I could alter your suggested JS code so I can identify the correct multiple choice answer for each question? Please note that my multiple choice answers are written as "You received a payoff of __ and a cost of __".
Thank you for your time.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.