MDL-69165 Questions: Incorrect id used in init_submit_button function
This commit is contained in:
+2
-2
@@ -179,9 +179,9 @@ M.mod_quiz.nav.init = function(Y) {
|
||||
pageno = 0;
|
||||
}
|
||||
|
||||
var questionidmatch = this.get('href').match(/#q(\d+)/);
|
||||
var questionidmatch = this.get('href').match(/#question-(\d+)-(\d+)/);
|
||||
if (questionidmatch) {
|
||||
form.set('action', form.get('action') + '#q' + questionidmatch[1]);
|
||||
form.set('action', form.get('action') + questionidmatch[0]);
|
||||
}
|
||||
|
||||
nav_to_page(pageno);
|
||||
|
||||
+6
-1
@@ -127,10 +127,15 @@ M.core_question_engine.questionformalreadysubmitted = false;
|
||||
* @param slot the number of the question_attempt within the usage.
|
||||
*/
|
||||
M.core_question_engine.init_submit_button = function(Y, button, slot) {
|
||||
var totalQuestionsInPage = document.querySelectorAll('div.que').length;
|
||||
var buttonel = document.getElementById(button);
|
||||
var outeruniqueid = buttonel.closest('.que').id;
|
||||
Y.on('click', function(e) {
|
||||
M.core_scroll_manager.save_scroll_pos(Y, button);
|
||||
buttonel.form.action = buttonel.form.action + '#q' + slot;
|
||||
if (totalQuestionsInPage > 1) {
|
||||
// Only change the form action if the page have more than one question.
|
||||
buttonel.form.action = buttonel.form.action + '#' + outeruniqueid;
|
||||
}
|
||||
}, buttonel);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user