Viewsform has incorrect form submit URL if loaded through ajax

Created on 7 August 2020, almost 4 years ago
Updated 27 March 2024, 3 months ago

Problem/Motivation

Getting an error when loading in a view through ajax, if it contains fields implementing "viewsForm".

Symfony\Component\HttpKernel\Exception\HttpException: The specified #ajax callback is empty or not callable. in Drupal\Core\Form\FormAjaxResponseBuilder->buildResponse() (line 67 of core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php).

Steps to reproduce

  • Install Drupal 11.x with standard profile
  • Add block display to people view at /admin/structure/views/view/user_admin_people
  • Enable "Use AJAX"
  • Disable the page display
  • Place "People" block in the Content region at /admin/structure/block
  • Navigate to the front page and apply a filter to the view (e.g. Status = Active), then hit Filter
  • Select any of the Actions in the view
  • Press the checkbox next to the admin user in the table
  • Press Apply to selected items
  • 404 page displays

Proposed resolution

This is the good part. I think it is already fixed in a similar situation with exposed forms.
https://www.drupal.org/project/drupal/issues/2866386 📌 Assert the view path is set correctly after second ajax request Fixed
https://www.drupal.org/project/drupal/issues/2820347 🐛 Exposed filter reset redirects user to 404 page on AJAX view when placed as a block Fixed
https://www.drupal.org/files/issues/2019-07-22/2820347-129.patch

In this issue the way the #action property is built has been changed. Applying this same change (with a quick patch) seems to resolve the issue.

Remaining tasks

Is there need for a Meta to make sure that all similar cases are fixed
#21 the front page you are sent back to /node instead of /.
Code review
Test only version where test fails

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Views 

Last updated about 6 hours ago

Created by

🇳🇱Netherlands jefuri

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

Merge Requests

Comments & Activities

Not all content is available!

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

Production build 0.69.0 2024