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.
This commit is contained in:
@@ -291,10 +291,16 @@ M.util.show_confirm_dialog = function(e, args) {
|
||||
if (target.get('name') && target.get('value')) {
|
||||
targetform.append('<input type="hidden" name="' + target.get('name') +
|
||||
'" value="' + target.get('value') + '">');
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user