I have one question regarding how to score a "text entry". In my study, participants study image-name pairs and take a test. In the test, I show them the image, and also the first letter of the name, participants should input the missing part of the name in the text entry blank. I use loop & merge to do this. Please see the attached picture. Field 5 is the first letter of the name. Field 6 is the correct answer. I want to compare participants' input with Field 6 (the correct answer). But it seems that the scoring function in Qualtrics could not achieve this. The logic is clear. If the "text entry" equals to ${lm://Field/6}, then score = 1, if not, then score = 0. I think maybe a JavaScript is helpful. But I have no knowledge about how to write a JavaScript. Is there anyone who can help me? I will be very much appreciated.
PS. I can add a feedback using the display logic. If the input = ${lm://Field/6}, then display the text "you are right". I tried to think this question in another way: to calculate how many times this feedback is displayed. That equals to the correct score. But I can't find a way to calculate the display times of a question. Help!!!!
Hi Tian, I believe one of our resident Qualtrics Wizards, TomG, has already provided a solution on another post that should address your query.
Cheers,
Cameron
HiCamM , thank you for your reply!
Actually I have tried the code in that post Loop & Merge with Scoring (text box) — Qualtrics Community, but unfortunately it did not work. I am sorry that I have no prior knowledge with JavaScript, please forgive me if I have make silly mistakes.
Referring to what Jiayi and TomG have discussed, I tried the following steps:
First, I set an embedded data field named CorrectNum, and set it to 0, before the Loop & Merge Block.
Here is what my loop and merge block looks like: for convenience I only include one case now
and it looks good
Second, I add JavaScript in the "Text entry" part for scoring. Do I understand right?
And my JavaScript is based on Jiayi , here is the code:
Actually I did not understand the first line: why there is a field named EndLoop? Should I set the field "EndLoop" in my embedded data?
Third, I add a feedback block after the loop and merge block, and retrieve the embedded data "CorrectNum".
But it did not work, unfortunately.
Did I get something wrong? Could you please help me find out what I am missing?CamM Jiayi TomG I will be very much appreciated.
Thank you very much for your time!
Finally I figured this out based on Loop & Merge with Scoring (text box) — Qualtrics Community.
It is important to firstly set an embedded data named "score" and set its initially with 0.
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
score = Qualtrics.SurveyEngine.getEmbeddedData('score');
var input = $(this.questionId).select('.InputText');
var answer = input p0].value;
var solution = "${lm://Field/6}";
if (answer === solution) {
score++;
}
Qualtrics.SurveyEngine.setEmbeddedData("score", score);
});
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
});
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.