I'm trying to create an interaction within a question that would score the question based on how many times it takes for the user to select the "correct" answer. I've set the item scores so the correct answer is 5 and the incorrect answers are -1. I just cannot figure out how to code the question so the users score would reflect the number of times it took for the user to reach the correct. Example: First response incorrect = -1; second response incorrect = -1; third response correct = 5 - (incorrect response 1 + incorrect response 2).
Does that make sense? I'm honestly not the best at coding. I know the logic (at least how I'm thinking about it), but not how to make it happen from a code perspective.
Thank you for your time,
Amanda
Page 1 / 1
Thank you, Shashi. I understand how to set a score for each answer option. My issue is how to code the question to calculate the score I'm looking for. I'm trying to emulate an experience that occurs in Team Based Learning where students use scratch cards to answer multiple choice questions. If the students scratch the correct answer first they receive full points (5). If the students miss the answer the first time, they can keep scratching until they receive the correct answer. The score is then based on how many items they had to scratch off before they received the correct answer. Thus my example in my initial question.
Here is a video that shows IF-AT cards (unfortunately it does not describe the scoring.
https://www.youtube.com/watch?v=2vnCMkt0SdU
Here is a video that shows IF-AT cards (unfortunately it does not describe the scoring.
https://www.youtube.com/watch?v=2vnCMkt0SdU
Hello @alealbright ,
The above requirement is acheived using MultiChoice ( Single answer ) question type and Custom code (JS):
Please follow the below steps:
Step 1: Create an embedded variable( eg: SC_Q1 ) for each question as the first element in the survey flow to store score of each question.
Step 2: Paste the below code in the js(onReady)
var CorrectAnswer = "3"; //choice number of correct choice
var that = this.questionId;
var sc=0;
jQuery("span.LabelWrapper label span").text("");
jQuery("#"+that+" input[type='radio']").on('click',function(){
if(jQuery(this).prop("checked")==true){
if(jQuery(this).attr("choiceid")==CorrectAnswer){
jQuery("#"+that+" input[type='radio']").parent().css("pointer-events","none");
jQuery(this).parent().find("span.LabelWrapper label span").html("★");
Qualtrics.SurveyEngine.setEmbeddedData('SC_Q1',(5-sc));
}else{
sc=sc+1;
jQuery(this).parent().css({"pointer-events":"none","background-color":"lightgrey"});
jQuery(this).parent().find("span.LabelWrapper label span").text("Scrathed, try another");
}
}
});
Please find the attached QSF for reference and for test link click here
The above requirement is acheived using MultiChoice ( Single answer ) question type and Custom code (JS):
Please follow the below steps:
Step 1: Create an embedded variable( eg: SC_Q1 ) for each question as the first element in the survey flow to store score of each question.
Step 2: Paste the below code in the js(onReady)
var CorrectAnswer = "3"; //choice number of correct choice
var that = this.questionId;
var sc=0;
jQuery("span.LabelWrapper label span").text("");
jQuery("#"+that+" input[type='radio']").on('click',function(){
if(jQuery(this).prop("checked")==true){
if(jQuery(this).attr("choiceid")==CorrectAnswer){
jQuery("#"+that+" input[type='radio']").parent().css("pointer-events","none");
jQuery(this).parent().find("span.LabelWrapper label span").html("★");
Qualtrics.SurveyEngine.setEmbeddedData('SC_Q1',(5-sc));
}else{
sc=sc+1;
jQuery(this).parent().css({"pointer-events":"none","background-color":"lightgrey"});
jQuery(this).parent().find("span.LabelWrapper label span").text("Scrathed, try another");
}
}
});
Please find the attached QSF for reference and for test link click here
That definitely got me closer. Thank you, Shashi
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.