Adapt a JS code to "Check your answer"

PolcamposPolcampos Community Member Qubie ✭
edited January 18 in Custom Code

Adapt a JS code to "Check your answer"

Hi,

A few days ago I asked how to introduce 3 chances to guess the answer of a Quiz question (https://www.qualtrics.com/community/discussion/14046/three-validation-tries#latest). @ahmedA very kindly provided me with a code that fit my needs perfectly.

My issue is that, while in some questions the answer is only 1 text entry (X), in others the answer consists of two text entries (X and Y). See for example this picture (where I use the "Text Entry/Form" tool of Qualtrics).

I have been trying to adapt the code unsuccessfully, but I think that this should have a simple solution for someone who has JS knowledge. My two questions:

  1. In the JS code from above link I think I fetch students' answer with the command: "given_answer = Number(el.value);". If I instead have two entries (I am using a Text Entry/Form question with 2 questions), which command should I use to fetch the first text entry and which should I use to fetch the second one?
  2. Is there any way I can make the "Check your answer" button appear below the two boxes? Now the "correct answer" is for example X=3 and Y=10. So I would like to have the "check your answer" button below so that it is clear to my students that they are checking both answers at the same time, and not only X.

Thank you very much!!!

Sign In to Comment