Require at least one correct answer when saving Multiple Choice activities

Hi I used AI to help me write this out to make it clear as possible
Description

I request a validation change in the H5P Multiple Choice content type so that saving (or publishing) a Multiple Choice activity requires at least one answer to be marked as correct. Currently, business users can save a Multiple Choice activity without selecting any correct alternative, which leads to broken experiences for learners and extra rework for instructors.

Current behavior:

Users can create and save a Multiple Choice activity without marking any of the alternatives as correct.

The activity may be presented to learners with no correct answer, causing confusion or grading issues.

Expected behavior (feature request):

The editor should prevent saving/publishing a Multiple Choice activity unless at least one answer option is marked as correct.

If the user attempts to save without a correct answer, show a clear inline validation message (and/or a modal) explaining that at least one answer must be marked correct and highlight the relevant field(s).

User story / Use cases:

As an author/instructor, I want to ensure every Multiple Choice activity has at least one correct choice so that learner feedback and scoring behave predictably.

As a business user creating many activities, I want validation to catch missing correct answers at save-time so I don’t unintentionally publish broken content.

Suggested UX behavior:

Real-time validation: Show a warning in the editor interface as soon as there are zero items marked correct.

Block save/publish: If the user clicks “Save” or “Done” while there are zero correct options, prevent the action and surface an explanatory message such as: “Please mark at least one answer as correct before saving.”

Highlighting: Visually highlight the answer list area (or the specific options) so the user can quickly identify where to act.

Optionally provide a “Set first option as correct” quick-fix button if appropriate for some workflows (ask for confirmation).

Suggested acceptance criteria:

Attempting to save a Multiple Choice activity with zero answers marked as correct is blocked.

The editor displays a clear, accessible error message that explains the requirement.

The relevant area/options are visually indicated for quick correction.

The validation works both client-side and server-side to prevent programmatic bypass.

Existing saved content with zero correct answers should continue to load (backwards compatibility) but require correction on edit before re-saving.

Priority / Impact:

Priority: Medium (prevents publishing broken assessments; low implementation complexity)

Impact: High for authoring quality and learner experience

Technical notes / implementation options:

Client-side: Add a check in the editor save handler that verifies at least one answer has correct: true; show an inline error and prevent closing.

Server-side: Add a validation on content save to reject content JSON for this content type if no answers are marked correct (returns helpful error message). This prevents API-level bypass.

Back-compat: Do not automatically change existing activities; instead warn authors when opening items that have no correct answers.

Example error message text (copy-paste ready):

“You must mark at least one answer as correct before saving this Multiple Choice activity.”

Inline helper: “Tip: Click the checkbox next to an answer to mark it as correct.”

Thank you — happy to provide screenshots, examples of problematic content, or help test a patch/PR if useful.

Content types: 
0
0
Supporter votes Members of the Supporter Network can vote for feature requests. When the supporter network has generated sufficient funding for the top voted feature request it will normally be implemented and released. More about the H5P Supporter Network
otacke's picture

Sorry for not covering all your post, but there are valid pedagogical cases where you'd want no answer to be correct. I know that's against common schemes for MC test designs, but still ... 

papi Jo's picture

1.- You write "Hi I used AI to help me write this out to make it clear as possible". Well, I'm sure that was not your intention, but that AI output is ridiculously verbose. It would have been plenty sufficient for you to write "When authoring an  H5P Multiple Choice activity, the library should check that at least ONE answer is marked as correct".

2.- I agree with Oliver that there are cases when none of the answers provided as choices are correct. The usual way to still make one answer compulsory is to add an extra answer along the lines of "None of the above" (and of course disabling shuffling the answers).

3.- Unfortunately having the H5P library to check that the data entered in contents before saving is valid is not easy to implement, due to the nature of the programming process involved. Individual fields can be checked, e.g. fields expecting a number, and rejecting non-numeric values, maxlength, etc. Certain libraries, including MultiChoice, do have a presave.js script. One might hope that such scripts would ouput error or warning messages if some required fields are invalid or missing, but that does not seem to be the case.

Maybe Oliver can suggest a solution.

otacke's picture

It would require a simple additional editor widget to check that, but as I said: There are use cases that would break then.