Three validation tries | XM Community
Skip to main content

Hi,
I am designing a quiz on Qualtrics in which my students will answer one question at a time. The answer is always a number (text entry) from 0 to 100. I would like to give them 3 tries. If they answer the question correctly in any of these 3 tries, they get one point and move to the next question. If they do not answer the question correctly in any of the 3 tries, they do not get any point but move anyways to the next question.
I have two questions on how to implement this:

  • How can I design a validation check that gives them 3 tries and that sends them to the next screen as soon as 1) they answer correctly OR 2) they fail the 3 tries? (I found this related link, but unfortunately I do not know how to apply it to my case: https://www.qualtrics.com/community/discussion/comment/17110#Comment_17110)

  • How can I tell a Counter variable that it should increase by one if the student's answer was correct, but not do so if the answer was incorrect?

I am quite new to Qualtrics, so please do not assume I know much. Any help is really appreciated.
Thank you!

Please see if you are looking for something like this demo.
You can find the code and the implementation details here.


That was it ahmedA, your code works perfectly! This will also be helpful for other posts in which I've seen people asking similar questions. I cannot thank you enough!!!
I also found a way to introduce a counter variable in your code, so your code with the following slight modification answers my question perfectly. Thanks a lot again!
if (given_answer == desired_answer) {
that.clickNextButton();
btn.disable();
el.disable();
var practicejava = "${e://Field/practice_count}";
var practicejava1=parseInt(practicejava, 10);
var practicejava1 = practicejava1+1;
Qualtrics.SurveyEngine.setEmbeddedData('practice_count', practicejava1)


Sorry, I missed that. But I'm happy that you've figured it out. Give the students an easy test, that should be thanks enough 😊.


Leave a Reply