diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index 4daf38d6e7b..c6cdc2c369f 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -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 '
', "\n"; + '" enctype="multipart/form-data">', "\n"; echo '
'; + print_js_call('init_quiz_form'); /// Print the navigation panel in a left column. print_container_start(); diff --git a/mod/quiz/quiz.js b/mod/quiz/quiz.js index 267f7299cba..74e08402f7c 100644 --- a/mod/quiz/quiz.js +++ b/mod/quiz/quiz.js @@ -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) {