Thanks for the explanation, Elizabeth. It makes sense.
Joseph Rézeau
Beiträge von Joseph Rézeau
@Dominique,
Any idea how I could incorporate your "colouring" script directly into my answersselect question type?
Joseph
@Dominique "In my opinion, the presentation of the choices and their feedback in these question types should be like that of the multiple choice question, i.e. each choice and its feedback is grouped in a gray block. Eoin, maintainer of the All-or-nothing multiple choice question, and Joseph, maintainer of the Random select answers question, could probably make the change quickly. You could ask them to do it, here or in a tracker."
Quite right, Dominique. I've compared the get_per_answer_fields() function in the edit forms of the multichoice, the answersselect and the multichoiceset question types. It appears that in multichoice the 'fraction' element gets marked with an 'fitem_id_fraction_' ID, which can be targeted with a CSS rule. However, the checkbox element 'correctanswer' doesn't get marked with an ID containing the 'correctanswer' string. Which means it cannot be targeted by a CSS rule.
I have found a workaround which I have tested in my own answersselect question type and I have created a Pull Request on Eoin Campbell's github repo with the same workaround, if Eoin cares to implement it. Link to my PR there.
I have pushed the changes to my answersselect question type github repo and will shortly release it on the Moodle plugins repo.
There are 2 changes:
- In the edit form, add a 5th parameter (define a class) to $mform->createElement('checkbox', 'correctanswer',
get_string('correctanswer', 'qtype_answersselect'), '', 'class = "correctanswer"'); - In the CSS file create the relevant CSS rule body#page-question-type-answersselect .correctanswer { }
Result:

@Dominique,
You were 3 minutes faster than me.
I'll see what I can do for the Random Select Answers question type which I maintain.
Joseph
Hi Oleg,
You have 2 questions in the same post; it would have been better to post 2 separate posts. Anyway...
#1.- ...a way to distinguish correct/incorrect Choices and Feedback in quiz question edit mode. Currently the All-or-Nothing Multiple Choice Question , Random Answers Select, and a few related question types have similar formatting with gray background for Choice and Feedback sections (see print screen), which makes me confuse them regularly.
#2.- Also, I occasionally forget to check "Correct" check box. It would be great to have the coloring change from, say, bluish or reddish (for incorrect Choices) to greenish (correct Choices) and leave the Feedback as gray. Anyone knows a way to distinguish these sections?
#1.- You could put this CSS rule inside the Advanced Settings of your current Moodle site theme (works for these 2 question types)
body#page-question-type-answersselect [id*="fitem_id_feedback"],
body#page-question-type-multichoiceset [id*="fitem_id_feedback"] {
background-color: #e2e6ea!important;
}

#2.- This would need a js script, to trigger the colour change upon ticking the Correct choice box. Maybe our friend Dominique can suggest a solution.