handle empty radio answers

master
gtitov 3 years ago
parent 4d6a317882
commit 6bb28ddbc3

@ -67,6 +67,13 @@ document.addEventListener("DOMContentLoaded", function () {
var button = document.createElement('button'); var button = document.createElement('button');
button.innerHTML = 'Сдать'; button.innerHTML = 'Сдать';
button.onclick = function () { button.onclick = function () {
// TODO: move this logic to the backend check_answers function
// Populate quiz with empty answers (if no answer presented in select there'll be no property "answer" what could not be resolved in API)
for (const question of quiz.questions) {
question.student_answer = ""
}
// Replace the empty answers with real answers
const form = document.getElementById('form'); const form = document.getElementById('form');
const formData = new FormData(form); const formData = new FormData(form);
for (const [key, value] of formData) { for (const [key, value] of formData) {

Loading…
Cancel
Save