Retake Response: Some questions Read-Only? JavaScript? | XM Community
Solved

Retake Response: Some questions Read-Only? JavaScript?

  • 16 April 2021
  • 2 replies
  • 103 views

Userlevel 1
Badge +8

I am trying to have a retake link where some of the questions and selected answers can be viewed but not edited.
I know how to skip questions completely in the retake, and I can show or hide questions based on the retake link. But I cannot figure out how to in the retake link show some of the questions and selected answers, but read-only.
I think it's possible with javascript but I have all sorts of question types - multiple choice, text entry, dropdown, file upload.
For example, imagine that a student takes a test in Qualtrics, and the professor is reviewing that test and putting comments in a new text entry question at the bottom for students. I don't want the professor to accidentally change any of the students' answers. - (Please note that this is just an example scenario to get the idea across).
Thanks!

icon

Best answer by ahmedA 16 April 2021, 23:14

View original

2 replies

Userlevel 7
Badge +21

Something like this could probably work for you:
Create an embededd variable at the start of the survey, but do not give it any value. Lets call it

retake
.
When sending the links to the professors, add
retake 
as a URL query parameter (see the support pages for details). With a value to lets say
yes
.
To all your comment questions, add display logic to be only visible when
retake=yes
.
In the questions intended for students, add this JS to ensure that profs don't change the values, it will only be triggered if
retake 
is
yes
:
Qualtrics.SurveyEngine.addOnReady(function () {
    let rt = "${e://Field/retake}",
        quest = this;
    if (rt == "yes") {
        quest.questionContainer.style.pointerEvents = "none";
        quest.questionContainer.onkeydown = function (e) {
            e.preventDefault();
        };
    }
});

Userlevel 1
Badge +8

It totally works - you rock. Thanks!!!!!!!

Leave a Reply