Select a subpage

Hello and happy new year !

I come back to Kirby recent recently. I use demokit with agency party for create my portfolio of personal photo.

For first select “Villes”, I use:

# Ville
          ville:
            label: Ville
            type: pages
            query: kirby.page("agency/villes").childrenAndDrafts
            subpages: true
            multiple: false
            image:
              back: white
            width: 1/2

I want select a subpage [Agency / Villes / Lieux]. “Lieux” is a group of subpage in “Villes”. What YAML code do you use ? I think this that maybe not return.

# Lieu
          lieu:
            label: Lieu
            type: pages
            query: kirby.page("agency/villes/lieux").childrenAndDrafts
            subpages: true
            multiple: true
            image:
              back: white
            width: 1/2

I would have wanted that if “Ville” = “Paris” then choose a subpage (example: Tour Eiffel / Madeleine / Montmartre). How can I do?

Thanks.

That’s not possible, at least not out of the box.

While you could query the page chosen in the ville field, the options in the lieu field will only be updated after saving.

So you would need a custom field that listens to the first field changing.

See also this post: Programmatically change the content of the file field - #38 by bastianallgeier

However, I wonder if when you don’t use a query in the blueprint, but do the querying in a second field directly in vue, this could be solved without saving first… :thinking: