Page field settings

default is the name of my subdirectory?

from the doc

you can use:

option: children


option: visibleChildren

Good luck!

1 Like

Okay doesnt work for my situation, I need the children of another subpage… With options: pages , it works but I searched for a list which shows me only the children of a special directory. So the customer cant choose wrong pages…

Just read a lil further on the referenced doc page:

    label: Category
    type: select
    options: query
      fetch: children
      value: '{{uid}}'
      text: '{{title}}'
1 Like

thanks mate, my fault … used the wrong spelling

Can we still try to make this work using a custom page field? I prefer a proper autocompletion page field to a huge select field that pops down.

It shouldn’t be that difficult right? In the code for a page field, the input() method has a 'url' field, that we can perhaps rewrite?

public function input() {

    $input = parent::input();
      'field' => 'autocomplete',
      'url'   => panel()->urls()->api() . '/autocomplete/uris' //How to rewrite this?

    return $input;

1 Like

Yes, this is indeed a problem! I’ve been trying to fix it too. I can’t see my users scrolling through 50+ pages in a selection menu :confused:

The URL panel()->urls()->api() . '/autocomplete/uris' points to this method. It doesn’t currently support any filtering and will return every page.

You can however register a route from your own field and your route can return a filtered set.

I see.

For this routing solution, can you give an example of an approach? I tried a bit but I am confused of how to “connect” the route to the custom pages field, so that it reads from the custom pages field and returns the filtered set.


You can create a new field in site/fields/subpage/subpage.php with the following content:


class SubpageField extends PageField {

  public function input() {

    $input = parent::input();
      'field' => 'autocomplete',
      'url'   => purl($this->model, 'field/' . $this->name . '/subpage/autocomplete/' . $this->parent())

    return $input;

  public function routes() {

    return array(
        'pattern' => 'autocomplete/(:all)',
        'method'  => 'post',
        'action'  => function($parent) {
          $ids = page($parent)->children()->pluck('id');
          return response::json(array('data' => $ids));



You can then use this in your blueprint:

  label: Page
  type: subpage
  parent: my/parent/page

Let me know if that works.

I have created a feature request issue on GitHub about integrating something like this into the core page field.


Thanks for your solution. It does filter my input on the parent folder, so that it only gives autocompletion suggestions when I start typing the name of that parent.

But what I would like is to be able to have autocompletion for the children in that parent folder. So let’s say I have a content structure like this, where I filter for pages in the projects folder:


Then I would like to be able to type “lor” to see the autocompletion lorem, instead of typing “projects/lor”.

1 Like

You could try setting default: projects/ so that projects is already typed in (not tested);
Or customize the code from @lukasbestle

Easiest way would be to replace pluck('id') with pluck('uid') in my code, but please note that only the UID will be stored then, so you need to use page('projects/' . $page->mypage()) in your template to get the parent back.


Wonderful! Thanks a lot, this is just what was needed! It will be super useful to put this in some way in the next Kirby update, or just have a plugin :slight_smile:

As I wrote, I added this as a feature request. We can’t promise if that will be in the next release though. :slight_smile:

1 Like

This is good for my actual project so thanks you !

Though it’s not working when the subpage field is inside a structure field.

Any idea why ?

Works for me in a structure field. What exactly does not work? No autocompletion?

Exactly, and just for info, I also change the code for " pluck(‘uid’) " like it’s indicate here, but this is not where the problem come from.

Have you tried to log in and out again? Also, clear your browser cache.

I always clear the browser cache, I now tried to log in and out, and also tried on another browser but it still not working.