Invalid value for "Query" on Fetching Pages Field

Following query working properly

query: site.find("categories").children

But when use advanced query like that:

categories:
	label: Categories
	type: pages
	options: query
	query: 
		fetch: site.find("categories").children
		value: "{{ page.uid }}"
		text: "{{ page.title }}"

I got the

Invalid value for “query”

Kirby Version
3.2.2

This is about that and why accept only string?

com

The pages, files and users fields do not accepts the more complex query at the moment.

Is there any reason? Should I create an kirby idea?

Because when the slug of the page changes, the relationship breaks.
I need to disable the slug change so that the relationship does not break.
But slug change disabling not good for multi-language.

I want to create a fixed field and link the relationship to this field like autoId

We already have an issue for the users fields: https://github.com/getkirby/kirby/issues/1885

Trying to find if there is one for the pages/files field. Can’t find anything… Currently, the only alternative is using a select/multiselect field to be able to use the AutoID feature.

I completely agree with you that this is needed.

1 Like

Ah, found it: https://github.com/getkirby/ideas/issues/193 It’s already on the High Prio list.

Great! We are looking forward :+1:

Any news on this? I’m just asking, becaus this idea seems to have been on High Prio list for a while now.

The reason I tried using the more complex query and adding audoID as value is, that when I change the filename of i.e. an image, when I go back to the panel for the page itself, I have to re-select the image, because the file-field stores the image-name as value.
Or is there any other (simple or kirby-core) solution to this that I missed?

No, this is not yet implemented. As I mentioned above, your only alternative are other select type fields: select, multiselect, checkboxes and maybe the relationship plugin. Or of course a custom field based on the files field that implements this feature.

Thanks, I hadn’t seen the relationship Plugin.
Your support is awesome and so fast!

1 Like