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"

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

zbberlin created an issue. See original summary.

zbberlin’s picture

Issue summary: View changes
kpoornima’s picture

Assigned: Unassigned » kpoornima

working on it

kpoornima’s picture

StatusFileSize
new4.96 KB
new4.4 KB
new1.22 MB

@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

Before

After Updated png

after

Please refere video also

kpoornima’s picture

Assigned: kpoornima » Unassigned
Status: Active » Needs review
gilmord’s picture

@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)

zbberlin’s picture

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
zbberlin’s picture

StatusFileSize
new5.61 MB

The error appears when a exposed filter
was executed
and at the same time Ajax is active in the view

Then the 404 error appears in the Ajax request.

see my screencast

1) AJAX in the view is inactive: everything works fine
then
2) AJAX in the view is active: the changes are not saved and the error appears

sumit-k’s picture

StatusFileSize
new146.76 KB

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.
coaston’s picture

Priority: Normal » Major
Status: Needs review » Active
StatusFileSize
new7.53 KB

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

a

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. Does not matter if I use views or default display mode and change widget. It seems this module is not D10 ready.

maxilein’s picture

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.

erichomanchuk’s picture

StatusFileSize
new200.9 KB

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.

Error log message

wturrell’s picture

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…

rabindrakumar’s picture

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?

zbberlin’s picture

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().

zbberlin’s picture

aaronbauman’s picture

Suggestion in #15 does not work for me.

And, I've observed that even with ajax OFF, editable fields breaks with the 404 error after submitting the exposed filter.

So this is not limited to ajax-enabled views.

Closed #2966854: Views exposed filter compatibility as duplicate of this one.

heyyo made their first commit to this issue’s fork.

heyyo’s picture

With the help of AI, I have uploaded a new merge request that implements a dedicated AJAX submit route (/editablefields/form-ajax/...) for the EditableFieldsForm. It works perfectly for us. No more 404 after applying exposed filters.

The Problem:
When using editablefields inside complex contexts like Views with AJAX or deeply nested blocks, the default Drupal AJAX behavior (submitting to the current path) often fails with a 404 error if the current path's route doesn't match the form's expected parameters.

The Solution:
By introducing a dedicated AJAX endpoint, we ensure that the form submission always hits a route that understands exactly which entity and field are being processed, regardless of the user's current URL.

heyyo’s picture

Status: Active » Needs review