Skip to content

Commit

Permalink
dynamic sum display moved to text entry question
Browse files Browse the repository at this point in the history
  • Loading branch information
tafakkur committed Feb 22, 2021
1 parent 69fb39c commit 5f699d0
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions functions/Dynamic Sum on Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ Qualtrics.SurveyEngine.addOnReady(function () {
};

var all_questions = [];
document
.querySelectorAll("div[id^=QID]:not(.Separator)")
.forEach((item) => all_questions.push(item));
document.querySelectorAll("div[id^=QID]:not(.Separator)").forEach((question) => {
if (question.className.includes("TE")) {
display_cal = question.querySelector("input");
} else {
all_questions.push(question);
}
});

var display_cals = all_questions[all_questions.length - 1];
display_cals.readOnly = true;
display_cals.style.cursor = "not-allowed";
display_cal.readOnly = true;
display_cal.style.cursor = "not-allowed";

function cal_sum() {
var sum = 0;
Expand All @@ -23,7 +26,7 @@ Qualtrics.SurveyEngine.addOnReady(function () {
}
});
});
display_cals.querySelector(".InputText").value = sum;
display_cal.value = sum;
}
var config = { attributes: true, subtree: true };

Expand Down

0 comments on commit 5f699d0

Please sign in to comment.