Returning field value in the query of image field

Hello,

I believe it is an easy question but I am stuck on this. How could I get something that would produce this?

		query:  site.find(fields.project.value).images

in this:

project: 
		label: 'Select a Subpage'
		type: pages
		query: site.find('Home')
		max: 1
		
imageSelection:
		label: 'Image or Video'
		type: files
		query:  site.find(fields.project.value).images

I’ve been exploring the doc and couldn’t find that but I believe I just haven’t found it… haha

Thanks a lot!

This won’t work as expected, because 1) the syntax is wrong, and 2) you cannot get the value of the first field on the fly (i.e. when the value of the pages field changes).

Syntax would have to be

query:  site.find(page.project.toPage).images

This might show an error if there is no page selected (and saved) yet.

Hello!

I just get back on another project with the same situation where I would like to select one image from a project subpage I would select on a first field.

Is there any approach to make this more seemless without any error or even without any reload?
Can I make it save/reload/reopen the block drawer automatically when I select the page? (I think I’m being delusional here haha)

Thanks a lot for your help!

I think the only sensible solution would be a custom field consisting of two fields, with field 2 listening to changes in field 1.

1 Like