Skip to content

Commit

Permalink
resetting question when going back from a question
Browse files Browse the repository at this point in the history
  • Loading branch information
naiyume committed Jun 14, 2022
1 parent 71edd9a commit 55e4967
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
12 changes: 0 additions & 12 deletions questionnaire.js
Original file line number Diff line number Diff line change
Expand Up @@ -786,18 +786,6 @@ export function displayQuestion(nextElement) {
[...nextElement.querySelectorAll("span[forid]")].map((x) => {
let defaultValue = x.getAttribute("optional")
x.innerHTML = math.valueOrDefault(x.getAttribute("forid"), defaultValue)
/*
let elm = document.getElementById(x.getAttribute("forid"));
if (elm) {
if (elm.tagName == "LABEL") {
x.innerHTML = elm.innerHTML;
} else {
x.innerHTML = elm.value != "" ? elm.value : x.getAttribute("optional");
}
} else {
x.innerHTML = (x.hasAttribute("optional")) ? x.getAttribute("optional") : x.getAttribute("forid")
}
*/
});

Array.from(
Expand Down
3 changes: 2 additions & 1 deletion replace2.js
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,7 @@ export function stopSubmit(event) {
event.preventDefault();

if (event.target.clickType == "BACK") {
resetChildren(event.target.elements);
let buttonClicked = event.target.getElementsByClassName("previous")[0];
previousClicked(buttonClicked, moduleParams.renderObj.retrieve, moduleParams.renderObj.store, rootElement);
} else if (event.target.clickType == "RESET ANSWER") {
Expand All @@ -1123,7 +1124,7 @@ function resetChildren(nodes) {
for (let node of nodes) {
if (node.type === "radio" || node.type === "checkbox") {
node.checked = false;
} else if (node.type === "text" || node.type === "time" || node.type === "date") {
} else if (node.type === "text" || node.type === "time" || node.type === "date" || node.type === "number") {
node.value = "";
}
}
Expand Down

0 comments on commit 55e4967

Please sign in to comment.