quiz NOBUG fix some JavaScript errors.

This commit is contained in:
Tim Hunt
2010-08-11 16:31:52 +00:00
parent 6b24e35e79
commit 690510bd3d
2 changed files with 24 additions and 23 deletions
+1 -1
View File
@@ -155,7 +155,7 @@
// Some hidden fields to trach what is going on.
echo '<input type="hidden" name="attempt" value="' . $attemptobj->get_attemptid() . '" />';
echo '<input type="hidden" name="nextpage" id="nextpagehiddeninput" value="' . $nextpage . '" />';
echo '<input type="hidden" name="timeup" value="0" />';
echo '<input type="hidden" name="timeup" id="timeup" value="0" />';
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
// Add a hidden field with questionids. Do this at the end of the form, so
+23 -22
View File
@@ -129,35 +129,36 @@ M.mod_quiz.nav.init = function(Y) {
Y.all('#quiznojswarning').remove();
Y.delegate('click', function(e) {
if (this.hasClass('thispage')) {
return;
}
var form = Y.one('#responseform');
if (form) {
Y.delegate('click', function(e) {
if (this.hasClass('thispage')) {
return;
}
e.preventDefault(e);
e.preventDefault();
var pageidmatch = this.get('href').match(/page=(\d+)/);
var pageno;
if (pageidmatch) {
pageno = pageidmatch[1];
} else {
pageno = 0;
}
Y.one('#nextpagehiddeninput').set('value', pageno);
var pageidmatch = this.get('href').match(/page=(\d+)/);
var pageno;
if (pageidmatch) {
pageno = pageidmatch[1];
} else {
pageno = 0;
}
Y.one('#nextpagehiddeninput').set('value', pageno);
var form = Y.one('#responseform');
var questionidmatch = this.get('href').match(/#q(\d+)/);
if (questionidmatch) {
form.set(action, form.get(action) + '#q' + questionidmatch[1]);
}
var questionidmatch = this.get('href').match(/#q(\d+)/);
if (questionidmatch) {
form.set(action, form.get(action) + '#q' + questionidmatch[1]);
}
form.submit();
}, document.body, '.qnbutton');
form.submit();
}, document.body, '.qnbutton');
}
if (Y.one('a.endtestlink')) {
Y.on('click', function(e) {
e.preventDefault();
e.preventDefault(e);
Y.one('#nextpagehiddeninput').set('value', -1);
Y.one('#responseform').submit();
}, 'a.endtestlink');