Sequential quiz questions in Moodle 3.9

Sequential quiz questions in Moodle 3.9

by Kelly Parnell -
Number of replies: 1

Is there a way to give students a "heads up" regarding a quiz being set up sequentially other than in the description? Also is there a setting to warn them before they choose "next page" so that they do not proceed thinking that they will be able to go back if necessary to answer a previous question?

Average of ratings: -
In reply to Kelly Parnell

Re: Sequential quiz questions in Moodle 3.9

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hello Kelly,

You could add a Description type question on the first page of the quiz to warn students. You could also add another Description question as the last question on each page to alert students.

If you want the students to receive an even clearer warning, you could for example add a small script that attaches an alert to the "Next page" button and to the "Finish attempt ..." button. I don't think there is a setting or plugin for this.

I wrote a little script that does the job just fine. A teacher can simply put it in a quiz block. If you want to apply the code to the whole site, it might need a few tweaks to make sure it only takes effect for quizzes with the sequential navigation method.

Note that students can return to the last question after clicking on "Finish attempt ...". In my opinion, it's a bug in the sequential navigation method.

MoodleForum_20211202_0210.png

You can try the question at https://moodleformulas.org/course/view.php?id=77§ion=28 ↗.

Method

  • Copy the JavaScript code below.
  • Add an HTML block to your quiz and add the JavaScript code to the Content of the block.
  • In the Configuration of the block and under "Where this block appears", set "Display on page types" to "Any quiz module page".
<!--
© 2019-2021 Dominique Bauer
CC0 1.0 Universal Public Domain Dedication
-->

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
$(document).ready(function() {

    $("input.mod_quiz-next-nav[value='Next page']").on("focus", function() {
        var r = confirm("Are you sure you want to go to the NEXT PAGE?\n• Click [OK] to go to the next page\n• Click [Cancel] to stay on this page");
        if (r == true) {
            $("input.mod_quiz-next-nav").blur()
            $("input.mod_quiz-next-nav").click()
        } else {
            $("input.mod_quiz-next-nav").blur()
        };
    });

    $("input.mod_quiz-next-nav[value='Finish attempt ...']").on("focus", function() {
        var r = confirm("Are you sure you want to FINISH THE ATTEMPT?\n• Click [OK] to finish the attempt\n• Click [Cancel] to stay on this page");
        if (r == true) {
            $("input.mod_quiz-next-nav").blur()
            $("input.mod_quiz-next-nav").click()
        } else {
            $("input.mod_quiz-next-nav").blur()
        };
    });

});
</script>