MDL-12391 Prevent browser autocomplete in the quiz. Acutally, there was already code trying to do that, but it was not working. Fix it in HEAD only, because it is not a big deal, and so much has changed, it is not an easy back-port.

This commit is contained in:
tjhunt
2008-09-19 04:54:49 +00:00
parent ddf977898c
commit ea16a91d2e
2 changed files with 9 additions and 2 deletions
+3 -2
View File
@@ -80,6 +80,7 @@
/// Print the quiz page ////////////////////////////////////////////////////////
// Print the page header
require_js(array('yui_yahoo','yui_event'));
require_js($CFG->wwwroot . '/mod/quiz/quiz.js');
$title = get_string('attempt', 'quiz', $attemptobj->get_attempt_number());
$headtags = $attemptobj->get_html_head_contributions($page);
@@ -119,9 +120,9 @@
// Start the form
echo '<form id="responseform" method="post" action="', $attemptobj->processattempt_url(),
'" enctype="multipart/form-data"' .
' onclick="this.autocomplete=\'off\'" onkeypress="return check_enter(event);">', "\n";
'" enctype="multipart/form-data">', "\n";
echo '<div>';
print_js_call('init_quiz_form');
/// Print the navigation panel in a left column.
print_container_start();
+6
View File
@@ -6,6 +6,12 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
function init_quiz_form() {
var responseform = document.getElementById('responseform');
responseform.setAttribute('autocomplete', 'off');
YAHOO.util.Event.addListener(responseform, 'keypress', check_enter);
}
/* Use this in an onkeypress handler, to stop enter submitting the forum unless you
are actually on the submit button. Don't stop the user typing things in text areas. */
function check_enter(e) {