Fieldtype set in repeater field

Hi there,

I’m completely new to Cockpit and hope you can help.

I tried to set up a set field in a repeater field but that doesn’t work. Is my approach wrong?

{
   "fields": [
      {
        "type": "text",
        "label": "Text"
      },
      {
        "type": "html",
        "label": "Html Code"
      },
      {
        "type": "set",
        "label": "Multiple",
        "fields": [
         {
            "name": "name",
            "type": "text"
          },
          {
            "name": "about",
            "type": "html"
          }
        ]
      }
    ]
}

With that setup it says “Fields definition is missing”.

Best Regards
Jonny

You have to nest the fields inside set in {"options":{"fields":[...]}}

{
  "fields": [
    {
      "type": "text",
      "label": "Text"
    },
    {
      "type": "html",
      "label": "Html Code"
    },
    {
      "type": "set",
      "label": "Multiple",
      "options": {
        "fields": [
          {
            "name": "name",
            "type": "text"
          },
          {
            "name": "about",
            "type": "html"
          }
        ]
      }
    }
  ]
}
3 Likes

Thank you! That solved it. :slight_smile: