Disabling "Return to Attempt" in Quiz

Re: Disabling "Return to Attempt" in Quiz

by Dominique Bauer -
Number of replies: 3
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hello Ahmad,

With javascript, it is a little difficult to hide only the "Submit all and finish" confirmation. Here is  a temporary workaround. Add the following code in Site administration / Appearance / Additional HTML / Within HEAD (also works in When BODY is opened and Before BODY is closed):

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("a.endtestlink").css("display","none");
    $("input[value='Finish attempt ...']").on("focus", function(){
        var x = confirm("\n \n Submit all and finish?");
        if (x == true) {
            $("input[value='Finish attempt ...']").blur()
            $("input[value='Finish attempt ...']").click()
        } else {
            $("input[value='Finish attempt ...']").blur()
        };
    });
$("button:contains(Submit all and finish)").click();
});
</script>

This code replaces the "Summary of attempt" page with a window confirm message, then skips the "Submit all and finish" confirmation.

Also, $("a.endtestlink").css("display","none"); removes the "Finish attempt ..." link which is somewhat redundant and perhaps confusing.

Here's what you'll get:



Average of ratings: Useful (2)
In reply to Dominique Bauer

Re: Disabling "Return to Attempt" in Quiz

by aziz vefa -
Hi Mr. Bauer.
I have a quiz that has 4 questions.
I set the quiz time limit to 2 minutes. Also, I set the "open attempts are submitted automatically".
I answered 2 questions and logged out or left the quiz. I wait for the time is up, then back to the quiz again with the "continue to last attempt" button. The quiz is still in progress and I'm able to continue to answer. In the end, I finished the quiz with an overdue time. All my answers are saved and I passed the quiz. How can that happen?
The setting for "when the time expires" is working only if the student doesn't leave the quiz and time is up. Then the answers are saved and submitted automatically. That's ok. But as I see in that URL (https://docs.moodle.org/310/en/Quiz_settings) it should also be working "if the student starts a timed attempt, then leaves the attempt, and then later time expires."
Would you please help me?
Thank you.
In reply to aziz vefa

Re: Disabling "Return to Attempt" in Quiz

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
DId you do this as a student (logged in with a student account - not just a change role to)?
In reply to Dominique Bauer

Re: Disabling "Return to Attempt" in Quiz

by Francisco Mancera -

Thank you very much, for me your solution was very useful, I had been looking for something to skip that part for a long time