Moodle quiz navigation method

Moodle quiz navigation method

por Mario Gharib -
Número de respostas: 2

Dear Moodlers,

During an online quiz on Moodle composed of multiple pages where the navigation is sequential, I would like to know if it is possible to ask students, once they click on next page, if they are sure they want to go to next page;

The reason is to avoid clicking by mistake "next page".

Thanks.

Em resposta a 'Mario Gharib'

Re: Moodle quiz navigation method

por Dominique Bauer -
Foto de Documentation writers Foto de Particularly helpful Moodlers Foto de Plugin developers

Add the following script to the questions' text:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("input.mod_quiz-next-nav").on("mouseenter", function(){
        if (sessionStorage.nextPage!=1) {  
            var r = confirm("Are you sure you want to go to the next page?\nIf yes, click again on [Next page]");
            if (r == true) {
                sessionStorage.nextPage = 1;
            } else {
                sessionStorage.nextPage = 0;
            };
        } else {
             sessionStorage.nextPage = 0;
        };
    });
});
</script>

You will find an example with its XML on MoodleFormulas .

Em resposta a 'Dominique Bauer'

Re: Moodle quiz navigation method

por Dominique Bauer -
Foto de Documentation writers Foto de Particularly helpful Moodlers Foto de Plugin developers

The following script is simpler and works better:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("input.mod_quiz-next-nav").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()
        };
    });
});
</script>

You will find a second example with its XML on MoodleFormulas .