Required on Repeater Field

Hi

Is it possible to set a field in a repeater field to “required: true”? I tried this:

{
  "field": {
    "type": "set",
    "name": "level",
    "label": "Level",
    "options": {
      "fields": [
        {
          "type": "text",
          "name": "title",
          "label": "Titel",
          "required": true
        },
        {
          "type": "repeater",
          "name": "options",
          "label": "Optionen",
          "required": true,
          "options": {
            "field": {
              "type": "set",
              "name": "option",
              "label": "Optionen",
              "options": {
                "fields": [
                  {
                    "type": "text",
                    "name": "title",
                    "label": "Titel",
                    "required": true
                  },
                  {
                    "type": "file",
                    "name": "sound",
                    "label": "Sound"
                  }
                ]
              }
            }
          }
        }
      ]
    }
  }
}

but it ignores the required in the form.
Thank you for any help!

Patrick

can you try to set the required attribute inside an “options” attribute, e.g.:

"fields": [
  {
    "type": "text",
    "name": "title",
    "label": "Titel",
    "options": {
      "required": true
    }
  }
]
2 Likes

aah! you’re right, option did the trick.
do you know if it is also possible to set the option “localize” to some of the fields within a repeater?

1 Like

Don’t think so, that’s a definition available only on the main collection fields.

Ok that would be a reply to Localize a sub field in a repeater (options)