From 081c1555a639a6e4f308e3ed1e475c4aa3cfb4ca Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 7 Sep 2018 09:03:19 +0200 Subject: [PATCH] MOBILE-2567 quiz: Fix render offline answers in multichoice questions --- src/core/question/providers/helper.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/core/question/providers/helper.ts b/src/core/question/providers/helper.ts index f1c9b5b3c..0bce778ca 100644 --- a/src/core/question/providers/helper.ts +++ b/src/core/question/providers/helper.ts @@ -465,10 +465,19 @@ export class CoreQuestionHelperProvider { if (selected) { selected.setAttribute('selected', 'selected'); } - } else if (element.type == 'radio' || element.type == 'checkbox') { - // Check if this radio or checkbox is selected. + } else if (element.type == 'radio') { + // Check if this radio is selected. if (element.value == question.localAnswers[name]) { element.setAttribute('checked', 'checked'); + } else { + element.removeAttribute('checked'); + } + } else if (element.type == 'checkbox') { + // Check if this checkbox is checked. + if (this.utils.isTrueOrOne(question.localAnswers[name])) { + element.setAttribute('checked', 'checked'); + } else { + element.removeAttribute('checked'); } } else { // Put the answer in the value.