Panel with Select within Structure does not show looked-up title

panelfield

#1

When moving a working Select field:

fields:
  artist:
    type: select
    options: query
    query:
      page: artists
      fetch: children
      value: '{{uid}}'
      text: '{{title}}'

… into a Structure:

fields:
  relatedartists:
    type: structure 
    label: Artists
    style: table
    fields:
      artist:
        type: select
        options: query
        query:
          page: artists
          fetch: children
          value: '{{uid}}'
          text: '{{title}}'

… the text part of the query is replaced by the the value part in the panel, so the uid is shown instead of the title. As mentioned when the identical field and its query are outside of the structure, it works and the title is shown.


#2

I can’t reproduce this, have you made. sure your indentation is correct?


#3

Yes. I also tried it in an empty project and it does not work.

But it is good to know that it should work, because then it makes sense to further “investigate” here…


#4

What is your Kirby version?


#5

The version is 2.5.10.


#6

I put your field from above into a fresh starter kit and everything works as expected, the only change I made was to the page because a Starterkit doesn’t have an artists page.

Does the title field exist? Maybe you named it differently?


#7

Yes, it does. The same field blueprint works perfectly when it is outside of the structure.


#8

What happens if you remove the text option? Title is the default, so it’s a bit weird that the uid is shown. The UID is the fallback value if no title exists.


#9

There is no change without the text option: the uid is shown. I also tried different fields to no avail. This is the “related” blueprint file part:

  title:
    label: Artist
    type: text
    required: true

So nothing special. I think I have to step through with the debugger to see what’s happening.


#10

Have you tested this in a fresh starterkit? All I can say that is works without any problem in my starter kit setup and have no idea how to reproduce your issue.


#11

Just did (new download of the start kit). Does not work. I must be doing something wrong.

Here is the code of the three files:

# artists.yml

title: Artists

pages:

  template: artist

fields:

  title:
    type: text
    label: Title
    required: true

# artist.yml

title: Artist

fields:
  
  title:
    label: Artist
    type: text
    required: true

# test.yml

title: Test

fields:

  relatedartists:
    type: structure 
    label: Related artists
    fields:
      artist:
        type: select
        options: query
        query:
          page: artists
          fetch: children
          value: '{{uid}}'
          text: '{{title}}'

#12

Hi,

Any news for this ?
I have exactly the same problem… : in the pannel, the “structure” table show the value of the select.
Same code as Eliott
Kirby 2.5.10


#13

This finally made me understand what the real problem was.

If the table shows the UID (i.e. the value instead of the text) after you have selected something and saved, that is the expected behaviour, because the table shows the value that is stored in the text file. The text/value thingy is only relevant for the select field options themselves, the option in the select should show the title of the option, while the UID of the selected option gets stored. So nothing wrong with that at all.

Select field within structure, in this case querying the children of the projects page in a starter kit on the home page

As you can see, the title is shown as option display.

After clicking on add, the value is shown in the table. If you edit the entry, the select field comes up and shows the title again.

If you don’t like the standard behavior, you might want to check out the snippet field

Another - in this case probably better - option to consider instead of a select within a the structure field, is the relationship field.


#14

Ok !
Thanks for the answer and advice