From 2efc4678bca33da5a09078e54e3c06d2f96ffa7a Mon Sep 17 00:00:00 2001 From: David Beguin Date: Thu, 16 Apr 2020 08:00:46 +0000 Subject: [PATCH] [FIX] survey: block selection by key when already answered in session Before this commit, during a session, it was still possible to select another choice (in a multiple choice question) even after having selected and submitted an answer. After this commit, if the question has already been answered or time limit already ran out, it's not possible to use key to select another choice. Task ID: 2230980 X-original-commit: e1acda0493092f5020576fc30768141a99b9fd48 --- addons/survey/static/src/js/survey_form.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/survey/static/src/js/survey_form.js b/addons/survey/static/src/js/survey_form.js index e4bcf76fea9..ada2b644d32 100644 --- a/addons/survey/static/src/js/survey_form.js +++ b/addons/survey/static/src/js/survey_form.js @@ -85,6 +85,10 @@ publicWidget.registry.SurveyFormWidget = publicWidget.Widget.extend({ if (this.$("textarea").is(":focus") || this.$('input').is(':focus')) { return; } + // If in session mode and question already answered, do not handle keydown + if (this.$('fieldset[disabled="disabled"]').length !== 0) { + return; + } var self = this; var keyCode = event.keyCode;