We have posted 7 questions in using a quiz module (type: essay) out of which students should attend only 5. So is there a way when a student has attended any 5 questions, the other 2 should be restricted. Please help us! Thanks! @TimHunt
How to limit the number of questions to be attended by students in a quiz if we give a choice
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
How did you handle this in paper exams? Did you have answer books that automatically locked themselves after students had written answers to 5 questions? (I bet they had those at Hogwarts!) Or, what if the students just makes some notes in the answer box on Q6, but then decides they don't really want to answer that one, they want to write a proper answer to Q6?
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
I did something using only javascript. Note that the teacher must clear his sessionStorage before marking.
Next time, I will try to use PHP too, which will probably make it better.
XML file attached:
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
I found your approach above very useful, Many thanks for it.
Please you can help describe or instruction on how you apply this solution to a quiz plugin or multiple quizzes. Because if I have many quizzes, Do I need to edit the XML one by one? I will appreciate your kind response.
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
I improved the code. It could be further improved to facilitate the necessary modifications to allow different numbers of selected topics / available topics.
Anyway, all you need to do is insert the code into the question text HTML code of the multiple choice question with which students can select their essay topics. I put comments in the code to make the changes simple.
Someday I'll make it a plugin, but for now the javascript workaround should work fine.
https://moodleformulas.org/course/view.php?id=80§ion=1 ↗
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
Hi Dominique,
Thank you for a great job, your Javascript workaround will exactly solve my present problem. If I may ask, is there a need for creating 4 essay questions apart from the initial multiple-choice question that has the selections option and will the essay manual grading be the same? Or if you can share the .mbz file of the course it will be clearer for me on the implementation of your code.
Many thanks once again.
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
Many Thanks.
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
Hi Dominique,
Many thanks for the solution. I realize that the Question Behavior under the quiz setting has to be set at "Adaptive mode" for the button to display. It's now working as per your implementation. Thank you.
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
But I will appreciate if you can share the .mbz file for the course.
Many Thanks.
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
The javascript workaround method is now fully automated and fairly easy to use. I also added more explanations including the quiz settings, etc. (At this time, I do not distribute the .mbz files.)
https://moodleformulas.org/course/view.php?id=80§ion=1 ↗
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
You made it much easier than it was before. Thank you.
Please is there suppose to be different in MOODLE version? I'm using 3.8.2 and I have implemented it exactly the way you describe but when I select the topics it always returns wrong topics instead of the selected ones. e.g: when I select topic 1,2,3 it returns Topic 2,3,4 and 5. Please could you help me clarify?
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
I just tried it on Moodle 3.9 and it works fine. I think it should work on 3.8.2.
- how many choices there are in the multiple choice question (it must equal the number of topics available ),
- the values of n (number of topics to select) and m (number of available topics),
- the number of essay questions in the quiz (it must be equal to the number of topics).
Also make sure that when you preview a quiz, always click on "Start a new preview", but here, as the navigation block is hidden, you must first click on "Finish attempt...", then on "Start a new preview".
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
All of the parameters are correct. I import your MCQ question directly into a new quiz and create the five essay questions but still, it's not returning correct values when I choose number of topics. please Any more suggestions on why it's not working?
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
Hi Dominique,
Thank you for all your support. I have upgraded my MOODLE version to 3.9. However, I realize the problem is caused by my present theme installed (academi). When I change the theme the scripts run as expected but when I enable it, it returns wrong topics. Any suggestion on how to pix that?
Many thanks.
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
I just tried with the Academi theme and it works great. The "choose essay topics" script is pretty straightforward, it should work fine on most platforms.
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
I have just made a fresh MOODLE installation on my server and tried the "choose essay topics" scripts, it worked perfectly. But Once I installed "academi" theme on it the scripts stop working and returning wrong essay number on button click. Can you help share with me the version of academi you installed and got it to work?
I used V3.9 stable.
Many thanks
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
I ran the script on a Moodle 3.7 install with Boost and Academi themes and on a Moodle 3.9 install with Boost theme. I used the latest release of Academi, i.e. v3.9 for Moodle 3.9, currently available on the Moodle plugins site.
Again, the script is very simple and therefore should work regardless of the theme. I don't know what is causing the problem. Have you tried clearing the Moodle caches? (Site administration / Development / Purge caches). Have you tried clearing the browser cache?
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
In fact, I think I know where the problem is coming from.
There are different ways to load a script, which changes when it fires versus when the page loads, and therefore can affect how it works. These different ways may be interpreted differently from browser to browser, which makes using client-side javascript a bit tricky. It would probably be better if the script was on the server side for better control and proper functioning.
Thinking I was doing the right thing, I used the rigorous JavaScript "window.onload" event. Maybe the jQuery $(window).on("load",handler) is better. So I modified the script, which you will find attached. Please keep me posted on whether it works for you.
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
Hi Dominique,
Thank you for your continuous support.
I use the JQuery version of the script but it is given the same problem. I observed that on button click the scripts execute and display the right topics within a second, but once the page loads it will return invalid topics. Can it be there is an existing script that loads on the academi themes that is overriding the JQuery and Javascripts?
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
Re: How to limit the number of questions to be attended by students in a quiz if we give a choice
Thank you once again for a great job.
I have tried it, the delay is working but still, I couldn't get it to work effectively. It's returning the wrong topics still. I hope I can get more suggestion.
Many thanks