If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Question editing form improvements

From MoodleDocs
Question editing form improvements MDL-37417
Project state Prototype implemented, feedback wanted
Tracker issue MDL-37417, code at
Discussion Quiz forum thread
Assignee Colin Chambers

Moodle 2.4

This page describes proposed improvements that have been done by Colin Chambers, with some input from Phil Butcher and Tim Hunt at the OU, so that is who is meant by 'we' below. Note also that the screen-grabs are a mixture of the OU theme and the Moodle standard theme.


Many question type editing forms are long and unwieldy. The usability really needs to be improved, and so we have been experimenting with several ideas:

  1. Making all sections of the forms collapsible.
  2. Re-grouping the elements on the forms into sections, so the collapsible sections are more useful.
  3. Grouping some fields onto the same line to save space. For example, putting answer, grade and tolerance on the same line for numerical questions.
  4. Hiding the editing tools for 'small' html editors by default. For example for multiple choice choices. This saves a huge amount of space.
  5. Pre-filling the 'Overall feedback' form fields with some standard text.

Overall, we think we have made big improvements to the usability of these forms, but before such major changes could be made in Moodle, we need to know what everyone else thinks.

If you have any more ideas for making things even better, please let us know.

Expandable Sections MDL-30637

This is the ability for the user to collapse and expand form sections.

We developed a solution (outlined below). So did LUNS LUNS implementation of the same thing ([ MDL-30637]). Great minds think alike!

The functionality is almost identical. Their work is nearing integration and thus replaces our work.

Make the form sections more logical MDL-36534, MDL-36570, MDL-37466

Once you have collapsible sections of the form, it becomes really important that the sections of the form that you expand or collapse are logical units.

In the past, for example, we had a separate section for each choice in multiple choice questions, or each unit in a numerical question. These sections are too small, so we merged them.

Here is the new grouping on part of the numerical question type form:

choices grouped.jpg

And here is how the form used to look: (note that there was only space to show two choices in this screen-grab!)

choices original.png

Obviously, the specific changes depend on each question type, but we followed a general principle. For a typical question type we now have the following sections on the form:

  • General - question text, general feedback, and any other settings like 'Shuffle answers'
  • Answers / Choices / ... - all together in one section, for those question types that have such things.
  • Combined feedback - that is, the 'Feedback for any correct response' etc. - for those question types that have this section.
  • Settings for multiple tries - this now contains the penalty and all the hints.
  • Tags - as currently, the last section on the form.

Group some fields on the same line MDL-37422

This change is also visible in the previous section. The Answer, Grade and Accepted error are all on the same line. In fact the forms used to be like this way back in the days of Moodle <=1.7 and the fields got spread out in Moodle 1.8. The old arrangement seems like a better use of space, and Colin has finally tamed formslib to make that possible.

Hide editing tools from some html fields MDL-32750

For 'small' HTML editor, the HTML editor starts with the editing toolbar hidden:


You can click to reveal it if necessary:


At the moment this is implemented by having a 'whitelist' of form elements on the question editing forms to apply this to. The question is, should we do this automatically throughout Moodle. For example, we could apply this to any HTML editor that was smaller than X px high? Or we could require a 'collapsible' property to be set in the form definition.

Pre-fill the combined feedback fields MDL-31726

We would like to pre-fill the combined feedback fields as shown in this screen-grab.


This is a change that clearly makes sense for the OU, but may not be a good idea for anyone else. Note that these strings would be language strings, and so could be customised using Site administration ► Language ► Language customization.


This is a summary of the questions posed above:

  1. Any objection to re-grouping the fields into sections? (We think the new grouping is just better.)
  2. Any objection to grouping some fields on the same line? (Again, we think this is just better.)
  3. Is the collapsible editor a good idea?
    1. If so, to we apply it everywhere in Moodle?
    2. If so, how to we decide which editors to apply it to? By initial size? By requiring the form creator to add a class="..." attribute to the form elements to modify?
  4. Is pre-filling the combined feedback fields a good idea?