Created on 16 August 2023, almost 2 years ago
Updated 17 March 2024, over 1 year ago

Problem/Motivation

Steps to reproduce

On a fresh clean Drupal 9.5.8 install with editable field version 1.0.1:
a view on content type "simple page"
with title (format editable fields)
and exposed filter (on Node ID)
works fine until

Ajax has been enabled under views advanced settings
use Ajax : yes

A 404 Ajax error is thrown after submit

{
  "message": "\nAn AJAX HTTP error occurred.\nHTTP Result Code: 404\nDebugging information follows.\nPath: /views/ajax?nid=1&ajax_form=1\nStatusText: Not Found\nResponseText: {\"message\":\"\"}",
  "name": "AjaxError"
}

The changes are then no longer saved.

A notice:

without "use Ajax" is the action url of the form
"/path-to-view" (i.e. the path that was set in the view.

with "use Ajax" is the path then the action is the url of the form
"/views/ajax"

๐Ÿ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

๐Ÿ‡ฉ๐Ÿ‡ชGermany zbberlin

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

Comments & Activities

  • Issue created by @zbberlin
  • Assigned to kpoornima
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kpoornima

    working on it

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kpoornima

    @zbberlin Did n't get ajax error. it is working fine after enable ajax in view. @zbberlin After enable ajax please clear cache and check.

    Before updating png

    After Updated png

    Please refere video also

  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡บ๐Ÿ‡ฆUkraine gilmord ๐Ÿ‡บ๐Ÿ‡ฆUkraine

    @zbberlin if clearing cache does not help - please share the error log (not the ajax error text, but the actual log - in the watchdog or in your server logs)

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany zbberlin

    thanks for your help!

    here is the watchdog log:

    
    Type	page not found
    Date	Thursday, August 24, 2023 - 11:03
    User	admin
    Location	https://master-6zecc6bzaqy2cv2hnwsixtccemehuz50.tugboatqa.com/views/ajax?_wrapper_format=drupal_ajax&ajax_form=1&title=test
    Referrer	https://master-6zecc6bzaqy2cv2hnwsixtccemehuz50.tugboatqa.com/test
    Message	/views/ajax?title=test&ajax_form=1&_wrapper_format=drupal_ajax
    Severity	Warning
    Hostname	172.18.111.2
    Operations
    
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany zbberlin

    The error appears when a
    exposed filters
    was executed and at the same time Ajax is active.
    Then the 404 error appears in the Ajax request

    see my screencast

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sumit-k

    Replicated the mentioned issue, and it appears that enabling AJAX in Views is causing a conflict with the views exposed filter submit functionality. This conflict arises due to the AJAX form action path being overridden, which in turn affects the ability to perform updates.

    Here are the steps to reproduce the issue:

    1. Create a view page that includes the title field and select the "Formatted editable" option.
    2. Add the node ID field to the filter criteria and expose it.
    3. Enable AJAX for the view.
    4. Visit the view page and apply filters.
    5. Notice that the update functionality is no longer working due to the form action path being overridden.
  • Status changed to Active over 1 year ago
  • ๐Ÿ‡ธ๐Ÿ‡ฐSlovakia coaston

    I am unable to click on Update button at all.
    I have tried on Edge first and got this popup error:

    and then I tried with google chrome. I was able to click update button, but after I refreshed page it was reverted. Once I tried to clear cache, again the same popup also on chrome.

  • ๐Ÿ‡ฆ๐Ÿ‡นAustria maxilein

    It seems to be specific to the latest dev.
    On D10.1.6 with 1.0.1 it works..

    While after I installed the dev version. I had strange errors killing the site... Sorry that I cannot reproduce it any better.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada erichomanchuk

    It does not work with 1.0.1 on Drupal 9.5.11. To be more precise it works on a view with AJAX turned on but as soon as you use a filter or a sort on the view via ajax it no longer works the error in the log is "Page not found" when trying to edit a field.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom wturrell

    I am also seeing this, not with the Editable Fields module, but using a (custom written) view bulk operation accessed via a Webform submission listing. So I'm interested to know the root causeโ€ฆ

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia rabindrakumar

    Am also facing the same. Ajax Enabled Views + EditableFields in D-10 is not working. Tried with 1.0.2 / Dev version.
    Any update on this issue?

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany zbberlin

    I faced the Bug again
    Editablefields Form action broken when Views AJAX filters are used โ†’ causes 404 on submit

    Module: Editablefields
    Version: 1.0.2
    Drupal: 10.1+

    Description
    When using the Editablefields module inside a View with AJAX enabled, the action attribute of the rendered form becomes incorrect after a filter is applied.

    When no filter is used, the form action is correctly set to the expected endpoint (e.g. /start), and the editable field submit works fine.

    When a filter is applied, triggering an AJAX reload of the view, the formโ€™s action is rewritten to the AJAX callback URL of the View (e.g. /views/ajax?...).
    This URL is not a valid form endpoint, which results in a 404 error on submit.

    Steps to Reproduce

    • Create a View with a filter exposed and AJAX enabled.
    • Place an editable field (via Editablefields module) into the View.
    • Load the View normally โ†’ form works.
    • Apply a filter โ†’ View reloads via AJAX.
    • Inspect the editable form: the action attribute is now /views/ajax?....
    • Try submitting the editable form โ†’ you get a 404 error.

    Expected Behavior
    Editablefields forms should retain the correct form action, even when a View is reloaded via AJAX.

    Actual Behavior
    The form's action becomes /views/ajax?..., which is not a valid endpoint for form submissions, resulting in:

    AJAX HTTP error occurred.
    HTTP Result Code: 404
    Path: /views/ajax?...&ajax_form=1

    Attempts to Fix / Workarounds Tried

    • JavaScript patch: Attempted to fix the form action client-side before submission. It prevents the 404 but breaks Drupalโ€™s built-in AJAX handling (form submit no longer works correctly).
      $('.pq-editablefields-form').attr('action', '/start');
    • Manual triggering of Drupal AJAX: Using Drupal.ajax({...}).execute() also failed because the AJAX form submission logic requires correct context, tokens, and Drupal behaviors.
    • Form alteration via hook_form_alter() โ€“ not triggered for Views content loaded via AJAX.
    • Disabling AJAX on the View works as a fallback โ€“ but this is not an acceptable solution for use cases that depend on AJAX filters.

    Root Cause Analysis
    Editablefields uses the current page request to determine the action attribute. When the View is rendered via AJAX (after applying filters), the request path is the Viewโ€™s AJAX callback (/views/ajax?...). This gets wrongly used as the form action, which breaks the form.

    Recommended Solution (for maintainers)
    Ensure the action attribute for Editablefields forms is rendered correctly, based on the entity route or a dedicated controller, not from the current AJAX request.

    Possibly set the #action explicitly in the form build array using a stable URL like:
    $form['#action'] = \Drupal::url('my.custom.route'); // or route to the form handler

    Or determine the canonical route for the entity being edited, rather than relying on
    \Drupal::request()->getRequestUri().

Production build 0.71.5 2024