From 6e7f41715f2a9617bb897c5c42dde9bb6c620b33 Mon Sep 17 00:00:00 2001 From: Yuriy Osychenko Date: Mon, 17 Oct 2016 17:58:45 +0300 Subject: [PATCH] MDL-53098 lib: Mark form as submitted in confirmation dialog. If the quiz attempt use popup window with Javascript security it will show to the user misleading message that he is going to lose entered data. To avoid this we should mark form as submitted to turn off browser`s pop-up window when user confirms finishing attempt. Also we need to check if core_formchangechecker is present on a page. --- lib/javascript-static.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/javascript-static.js b/lib/javascript-static.js index 4cbbefceee5..e3ef087f17c 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -291,10 +291,16 @@ M.util.show_confirm_dialog = function(e, args) { if (target.get('name') && target.get('value')) { targetform.append(''); + if (typeof M.core_formchangechecker !== 'undefined') { + M.core_formchangechecker.set_form_submitted(); + } } targetform.submit(); } else if (target.test('form')) { + if (typeof M.core_formchangechecker !== 'undefined') { + M.core_formchangechecker.set_form_submitted(); + } target.submit(); } else {