Contextual filter don't work with ajax in view

Created on 19 July 2016, over 8 years ago
Updated 1 February 2023, almost 2 years ago

Assume three content types: Book, Chapter, Page

  1. Page has an entity reference field to Chapter
  2. Chapter has an entity reference field to Book

If you want to add a Page to a Book, you visit book/{node}/add-page. This shows the node-add form for a Page, but tries to grab the available Chapters to reference from the Book. It does so by using an entity reference view with the "Content ID from URL" contextual filter.

This set-up does not seem to work with autocomplete widgets according to the original report, perhaps because the widget is posting to something like ajax/foo/bar instead of book/1/add-page.

πŸ› Bug report
Status

Active

Version

9.5

Component
AjaxΒ  β†’

Last updated 1 day ago

Created by

πŸ‡«πŸ‡·France geoffvio

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    This came up as a Bug Smash daily triage target.

    Didn't try to reproduce, but sounds plausible that this doesn't work.

    Yeah, the context comes from the URL, which is indeed something /ajax/ for these requests. So we would need to pass the current URL along to the ajax request and use that I guess?

Production build 0.71.5 2024