Can I set authoring form parameters as mandatory?

Colin D's picture
Forums: 

I am creating a custom library which wraps several H5P libraries. When authoring content, users are given the choice of which libraries they use via a selection box. The semantics.json which achieves this is below. However, currently users can publish content without selecting a library, or entering data for all the fields. The form submit only fails when they do not enter a title at the start of the form. How can I control this behaviour to set other form fields as mandatory? Ideally, I would like to control the error message displayed when omissions are found following a form pre-submission check. Any ideas how to achieve this? I had no luck with including an 'optional' parameter for each library and setting it to false.   

{
      "name": "stage1",
      "type": "library",
      "label": "instructions...",
      "options": [
        "H5P.InteractiveVideo 1.22",
        "H5P.CoursePresentation 1.22"
      ]
    },
    {
      "name": "stage2",
      "type": "library",
      "label": "more instructions...",
      "options": [
        "H5P.ImagePair 1.4",
        "H5P.ImageSequencing 1.1"
      ]
    }