Hi Qualtrics Community,
I am writing to seek assistance with developing a Java Script code for a survey that I have created. I have to score a text entry and I need the answer to be scored taking case-sensitivity into account ("Wr12" would be correct, but "wr12" would not be). From this previous thread I understand that Qualtrics is case insensitive and that the solution is to develop a Java Script. (https://community.qualtrics.com/XMcommunity/discussion/5151/case-sensitive-scoring-validation-for-a-text-entry-question).
Unfortunately, it is my first time using a Java Script and was hoping that a colleague in this forum could assist me in creating a script I could implement.
Thank you in advance. Please let me know if you require any additional information.
Solved
Case-sensitive scoring
Best answer by Rudi
hi all,
I just modified your example slightly and it worked perfectly fine
I created a text entry question and evaluated the entry on PageSubmit
the string I compared against is stored in the embedded data field text3
Qualtrics.SurveyEngine.addOnPageSubmit(function(){let solution = "${e://Field/text3}"let textEntry = document.getElementById('QR~'+this.questionId).valuelet score;
console.log(textEntry)
if(solution === textEntry){score = 1
}else{score = 0
}
let text2 = Qualtrics.SurveyEngine.setEmbeddedData("score", score)});
best regards
Rudi
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
