Panel select field: Options from other field

I’m currently trying to populate a select field in the panel with options defined in a field of another page, as it is described here.

content/1-blog/blog.txt

Title: Blog

----

Categories: Sports,Media,Life,Society,Design

Now in the blueprint for the blog posts I want to fill a select field with those categories defined in blog.txt above, like so:

site/blueprints/article.php

fields:
  category:
    label: Category
    type: select
    options: field
    field:
      page: blog
      name: categories

But this gives me an empty select field.

What am I missing?!

Just to make sure: Are you testing the 2.3.0 beta version?

Nope, I’m on 2.2.3 with the Toolkit, Kirby and Panel.

This feature is not avaible in 2.2.3, as is stated in the docs, at the right of the headline there is a little badge. It’s a new docs feature, so I guess people have to get used to checking that out first.

Aaah, I see. Well thanks for clarifying, will try 2.3 then :slight_smile:

Pls. keep in mind that 2.3 was only released yesterday as a beta and is not ready for production yet.

Hopelessly trying to make it work for hours
I would like to have docs versioned as ‘docs/2.2.3/etc’
Better than I tinny little dimmed note at the corner
Never saw the tinny note

My fault :anguished:

It’s not just you. We agree with you that the note might be too tiny, so we will improve this.

1 Like

Hi,

I have the same issue and i’m using the 2.3.2 version

This is a first for me to use Kirby, usually I just do front of websites.
And it’s also a first to get involve in a forum !

Anyway,

I want to define categories with tags in the site parameters and use those categories by a select field in a different page.

So i have something like this :

blueprints/site.yml

producerCategories:
    label: Métiers
    type:  tags

and i want to use them here :

blueprints/producer.yml

categories:
    label: Métier
    type: select
    options: field
        field:
            page: site
            name: producercategories
            separator: ,

Can someone explain to me where am I wrong ?
Thanks

Hi @Polyactifs,

welcome to the forum :slight_smile:.

Two issues

  • field may not be indented but must be on the same level as options
  • use / instead if site
categories:
    label: Métier
    type: select
    options: field
    field:
      page: /
      name: producercategories
      separator: ,
3 Likes

Yeah, it’s working perfectly !
Thanks a lot !

Does this also work in kirby 3?

My blueprint looks like this and it isn’t working:

category:
   label: Kategorie
   type: select
   options: field
   field:
      page: ../
      name: categories
      separator: ,
   width: 1/4

“page: …/” for the parent worked in kirby 2.

Thx a lot for some help! :slight_smile:

See the docs: https://getkirby.com/docs/reference/panel/fields/select#options-from-other-fields

Should be something like this:

category:
  label: Category
  type: select
  options: query
  query:
    fetch: page("some-page").categories.split
    text: "{{ arrayItem.value }}"
    value: "{{ arrayItem.value.slug }}"

Thx a lot! I somehow overlooked this particular docs-article…

My code now looks like this and works fine:

  category:
    label: Category
    type: select
    options: query
    query:
      fetch: page.parent.categories.split
      text: "{{ arrayItem.value }}"
      value: "{{ arrayItem.value.slug }}"