Using a pages field in a custom dialog results in error

Hi, I have a custom dialog using k-form-dialog and a field defined like so:

client:
  label: Klient
  type: pages
  query: collection('clients')
  image: page.getCover
  multiple: false
  subpages: false
  width: 2/3

This is basically copy of the field as defined in the blueprint for the template that should be a result of this dialog.

The dialog shows up fine:
CleanShot 2022-12-04 at 02.23.16

However, if I click the field or (add) button, I get this error:
CleanShot 2022-12-04 at 02.24.02

I have no idea what’s wrong/missing, or how else can I implement a page selector in this dialog - Using select with type: query, or even PHP generated options also doesn’t seem to work.

Okay, I’ve trailed through Vue DevTools and now have a very vague idea about what this error message is about, but I can’t properly decode how to setup the endpoints prop.

Sidenote: I managed to get the select working by studying the custom add fields plugin

Okay. I now managed to make the error go away by simply stealing the endpoint from existing page/field and it… works. I’d rather do actual proper endpoint, but have no idea if there is a documentation like “preparing custom endpoint for usage in a page field in a custom dialog”

But what’s currently bigger problem, no matter how I close the “select page” dialog (cancel or submit), my custom dialog closes as well.

:pensive:

the “move pages” plugin from @clicktonext has a dialog with a pages select field afaik. you might be able to get a solution there.

Thanks, Bruno <3

That’s select, though, not pages field (which means no image, for instance)

NOT POSSIBLE CURRENTLY (as of dec 2022)

After consulting on Discord, Kirby currently doesn’t support stacking dialogs, so Pages field (with its “select page” dialog) won’t work inside the custom dialog.

For others landing on this topic: use select or multiselect field (or other options like toggles, if it fits your needs)