Skip to content

Commit

Permalink
Issue #705 - multiselect not working
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankSylvia committed Nov 10, 2022
1 parent af68c72 commit 46d0f76
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions resources/js/quickAuth/buildProblem.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Frank 02-17-21 Added div for comment button
// Boming 08-30-21 issue #421 circle answer before submit
// Frank 12-26-21 Issue #567 Disable multiChoice buttons and hide submit box and button

// Frank 11-10-22 Issue #705 Multiselect problems not working
var quickAuthBuildProblem = (function() {

//The module we are exporting
Expand Down Expand Up @@ -131,7 +131,7 @@ m.build = function(activity, previewMode) {
hint.innerHTML = parameterizeText(formatted_text, problemParams);
}
else{
alert("text missing for hint: "+i);
// alert("text missing for hint: "+i);
}
// DM 1/23/18. It looks like it might be possible to put images in {[]} in hoverText which means they should be located in problem_XXX/hint_YYY
if(isNotEmpty(hints[i].hoverText)){
Expand Down Expand Up @@ -187,9 +187,13 @@ m.build = function(activity, previewMode) {

if (mode !== "demo" && mode !== "example") {
// add the submit answer button
var multiSubmitButton = buildMultiSubmit();
multi_answers.appendChild(multiSubmitButton);
problemUtils.addMultiChoiceSubmitListener(document);
if(multiSelect) {
}
else {
var multiSubmitButton = buildMultiSubmit();
multi_answers.appendChild(multiSubmitButton);
problemUtils.addMultiChoiceSubmitListener(document);
}
}

}
Expand Down Expand Up @@ -312,9 +316,12 @@ function submitMultiSelectAnswer() {
for(var i = 0; i < answerRows.length; ++i) {
if(answerRows[i].style.display != "none") { //ignore rows for nonexistent answers
var letter = answerRows[i].dataset.letter;
//if the answer is selected, append it to the string
if(document.getElementById(letter + "Checkbox").checked) {
selections += letter;
// Only single letter answers. Don't include the 'submitButton' element
if (letter.length == 1) {
//if the answer is selected, append it to the string
if(document.getElementById(letter + "Checkbox").checked) {
selections += letter;
}
}
}
}
Expand Down

0 comments on commit 46d0f76

Please sign in to comment.