Avoid the "Finish attempt..." step

Avoid the "Finish attempt..." step

by Chiara Di Terlizzi -
Number of replies: 3
Is it possible somehow not to show the "Finish attempt..." button and to show directly the "Submit all and finish" button?
We would like to jump the answer revision step.

Also, would it be possible not to show the "start attempt" popup and go directly to the attempt?
Thank you!
Average of ratings: -
In reply to Chiara Di Terlizzi

Re: Avoid the "Finish attempt..." step

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
It is not currently possible to control these things. (But it is a feature that a number of people want, so it might get added one day.)

The 'Start attempt' pop-up only appears if if required, e.g. if the quiz has a password the student needs to enter, or if there is a time-limit, so starting right now is something the student could come to regret.

The finish attempt confirmation is there because for an important assessment, submitting before you are reasy is really, really bad. So we want to make that hard. I agree that for some informal quizzes, it would be better not to have it.
In reply to Tim Hunt

Ri: Re: Avoid the "Finish attempt..." step

by Chiara Di Terlizzi -
Thank you Tim for your kind, complete and quick answer!

You guessed, we have an informal situation and we would prefer ease to accuracy.

If there are/will be feature requests for these options, I would like to be informed and follow them. smile
In reply to Chiara Di Terlizzi

Re: Avoid the "Finish attempt..." step

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

Hello Chiara,

It's simple to do with just a few lines of JavaScript.

If you place the script in a Text block, it only applies to the quiz where you place this block.

  • In the quiz settings, set "Appearance/Show more.../Show blocks during quiz attempts" to "Yes".
  • In the block settings, set "Where this block appears/ Display on page types" to "Any quiz module page".

If you place the script in Site administration / Appearance / Additional HTML, the script applies to all quizzes on the site.

You will need to adapt the code to your specific situation. For example, if you allow multiple attempts, you may not want attempts to automatically proceed; you would then need to remove the line $("button:contains(Re-attempt quiz)").trigger("click");.

If your site is in a language other than English, you will need to replace in the script the phrases "Attempt quiz," "Re-attempt quiz," etc. with their equivalent in your language. For example, you may need to replace "Submit all and finish" with "INVIA TUTTO E TERMINA" (case-sensitive) in Italian.

Place the following code in the HTML content of the block. It works with the Boost theme in Moodle 4.x on a desktop computer, but not on the Moodle phone app.


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

    // Skip "Attempt quiz".
    $("button:contains(Attempt quiz)").trigger("click");

    // Skip "Re-attempt quiz".
    $("button:contains(Re-attempt quiz)").trigger("click");

    // Hide the "Back" button.
    $(".navitem a").text("Back").hide();
    // Skip "Continue your attempt".
    $("button:contains(Continue your attempt)").trigger("click");

    // Skip "Submit all and finish".
    $("button:contains(Submit all and finish)").trigger("click");

    // Skip "Back to the course".
    $("button:contains(Back to the course)").trigger("click");

});
</script>

The script can be easily modified if you want the student to confirm that they really want to finish the attempt (for example by adding an alert tag) or to deal with specific situations like a password, a time limit, etc.

You may also want to consider the excellent Embed questions filter plugin➚.