Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions content/docs/dynamic-default-values.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,36 @@ clicking the following link: `/#/collections/posts/new?title=first&object.title=
will open the editor for a new post with the `title` field populated with `first`, the nested `object.title` field
with `second` and the markdown `body` field with `# content`.

Here's an example using a multiple relation field. Given the configuration:

```yaml
collections:
- name: posts
label: Posts
folder: content/posts
create: true
fields:
- label: Title
name: title
widget: string
- label: Authors
name: authors
widget: relation
collection: "authors"
value_field: "name"
multiple: true
- name: authors
label: Authors
folder: content/authors
create: true
fields:
- label: Name
name: name
widget: string
```

clicking the following link: `/#/collections/posts/new?authors=first&authors=second`

will open the editor for a new post with the `authors` field populated with any pre-existing authors whose names match `first` and `second`.

**Note:** URL Encoding might be required for certain values (e.g. in the previous example the value for `body` is URL encoded).