Filepicker not working inside a list with elements fieldtype

My filepicker dropdown fields aren’t being populated with the list of page media as expected.
These troublesome filepickers are inside a list containing the elements field type.

Here’s a snippet from my page blueprint:

header.content_blocks:
  type: list
  style: vertical

  fields:

    .type:
      type: elements
      label: "Content Type"
      size: small
      default: image
      options:
          image: Image
          ...
      fields:

        image:
          type: element
          fields:
            .file:
              label: Select Image from Media
              type: filepicker
              folder: self@
              preview_images: true
        ...

I’ve noticed that the documentation for elements only includes text fields.
Is this a known limitation with the element field type?

Further info:

  • The filepicker dropdown is empty when I select it.
  • I get a “Not Found” error flash up when loading the page in admin.
  • Other filepicker fields work correctly outside of the list (ie: header.image works; the list of page media is shown when I click on the dropdown).
    – Text fields inside the elements field are working as expected.
  • If I move the .file to the root level (ie: header.file) OR outside of the elements field (ie: header.content_blocks.file) it works as expected. So the blueprint seems to be valid, it just doesn’t work when it’s inside the elements field type.
  • I’ve tried the on_demand option for the filepicker (no luck).
  • Similar thing (data not loading) is happening with other dynamic fields using data-options@ which might be related.
1 Like

I’m experiencing a very similar issue. Been wrestling with it for a white because it always almost seems to work.

I’m trying to make a list of image slides with a elements in each giving options for image src (custom_URL, current_page_media, first_uploaded, all_media)
Using MediaPicker works fine, and pagemediaselect as a field works anywhere else but once it’s inside an element it breaks with 404 errors.

Only work around for me is to show all options normally instead of within an organized elements field.

Anyone else experiencing this? Any reason a pagemediaselect shouldn’t work inside an elements element?

1 Like