Relation Widget Multi Select

My goal is to allow a user to relate a given item in collection A, to multiple items in collection B. It looks like the built in relation widget has support for this with the multiple field, in the docs here:

This doesn’t seem to work like I expect it to. I’m sure someone else has done something similar before, but I have not yet found it anywhere online. Am I misconfiguring the relation widget, or is there some kind of better approach using the selection widget?


Yeah, that’s be possible! Be aware that the relation widget only works with folder collections. Here’s an example:

  - label: Posts
    name: posts
    folder: data/posts/
    create: true
    slug: '{{title}}'
      - {label: Title, name: title, widget: string}
      - label: "Author"
        name: "author"
        widget: "relation"
        collection: "authors"
        searchFields: ["author_name"]
        valueField: "author_name"
        multiple: true

  - name: authors
    label: Authors
    folder: data/authors/
    create: true
    slug: '{{title}}'
    identifier_field: author_name
      - {label: Name, name: author_name, widget: string}

You could also use the list widget in combination with a nested relation widget. The UI is a bit more complex but it works just as well.


thanks for sharing @tomrutgers !

No problem @perry, happy to help!