Structure in list

I’m probably missing something very stupid but can’t seem to put my finger on it :man_facepalming:
Any extra eyes are appreciated :grimacing:

I defined a structure on the site.yml and I want to call it in a dropdown.
Dropdown stays empty :man_shrugging:

My site.yml

extraFormElements:
        type: structure
        label: Extra form elements
        fields:
          name:
            type: text
            label: What?

The dropdown:

relatedForm:
        label: Link to form
        type: select
        query: site.extraFormElements.toStructure

And also tried:

relatedForm:
        label: Link to form
        type: select
        query:
          fetch: site.extraFormElements.toStructure
          text: "{{ structureItem.name }}"
          value: "{{ structureItem.name }}"

Next step is to show a text field based on the fact that you selected something in the dropdown. I know you can do a when on the dropdown value but can you also do a when to check if something (doesn’t matter what) is selected or not?

Many thanks for any advice / feedback!

No, that is unfortunately not possible.

The select fields are missing the options key:

     relatedForm:
        label: Link to form
        type: select
        options: query # This line is missing
        query:
          fetch: site.extraFormElements.toStructure
          text: "{{ structureItem.name }}"
          value: "{{ structureItem.name }}"
1 Like

Like I thought, something stupid :man_facepalming: Cheers!
I see the correct amount of items now in the select so almost there. Just not seeing the text yet :thinking:

Probably written with invisible ink. I have no idea, what happens if you select such a secret item?

Does your structure field have stored items in the content file?

It doesn’t detect as a change so “unselectable” :thinking:
Very strange behaviour. It’s an simple plainkit setup. No special stuff or even plugins. The most special thing here is what I mentioned above. I’m thinking it might be a bug but I have no idea what I did to trigger it :man_shrugging:

Hm, is that the latest Kirby version 3.4.3? That field somehow looks different in my installation.

3.4.3 indeed strange thing happened in the meanwhile though. I’ve tried almost everything. As a last resort I created a new structure on a page instead of the site and used find, that worked. I switched it back to exactly the same code in this post and now it works … it’s exactly the same (github agreed, and all of the sudden it works … very strange stuff, that’s a day lost I will never get back in my life :sweat_smile:)

Thx for the help though @texnixe! :slight_smile: