/// 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);
// 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();
* @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) {