Add a javascript confirmation when submitting a quiz attempt

This commit is contained in:
moodler 2002-12-09 08:20:19 +00:00
parent 776dc2709f
commit 9307692fdf
2 changed files with 4 additions and 1 deletions

View file

@ -77,6 +77,7 @@ $string['quizclosed'] = "This quiz closed on \$a";
$string['quizopen'] = "Open the quiz"; $string['quizopen'] = "Open the quiz";
$string['quiznotavailable'] = "The quiz will not be available until: \$a"; $string['quiznotavailable'] = "The quiz will not be available until: \$a";
$string['random'] = "Random set"; $string['random'] = "Random set";
$string['readytosend'] = "You are about to send your whole quiz to be graded. Are you sure you want to continue?";
$string['regrade'] = "Regrade all attempts"; $string['regrade'] = "Regrade all attempts";
$string['regradecomplete'] = "All attempts have been regraded"; $string['regradecomplete'] = "All attempts have been regraded";
$string['regradecount'] = "\$a->changed out of \$a->attempt grades were changed"; $string['regradecount'] = "\$a->changed out of \$a->attempt grades were changed";

View file

@ -411,7 +411,9 @@ function quiz_print_quiz_questions($quiz, $results=NULL) {
return false; return false;
} }
echo "<FORM METHOD=POST ACTION=attempt.php>"; $strconfirmattempt = addslashes(get_string("readytosend", "quiz"));
echo "<FORM METHOD=POST ACTION=attempt.php onsubmit=\"return confirm('$strconfirmattempt');\">";
echo "<INPUT TYPE=hidden NAME=q VALUE=\"$quiz->id\">"; echo "<INPUT TYPE=hidden NAME=q VALUE=\"$quiz->id\">";
foreach ($questions as $key => $questionid) { foreach ($questions as $key => $questionid) {