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"
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | Screenshot 2023-12-14 at 10.36.30 AM.png | 200.9 KB | erichomanchuk |
| #10 | issu 2023-11-06 220354.png | 7.53 KB | coaston |
| #9 | Selection_146.png | 146.76 KB | sumit-k |
| #8 | editablefileds_error__screencast_00002.mp4 | 5.61 MB | zbberlin |
| #4 | AwesomeScreenshot-17_8_2023,3 50 42pm.mp4 | 1.22 MB | kpoornima |
Issue fork editablefields-3381413
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
Comment #2
zbberlin commentedComment #3
kpoornima commentedworking on it
Comment #4
kpoornima commented@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
Comment #5
kpoornima commentedComment #6
gilmord@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)
Comment #7
zbberlin commentedthanks for your help!
here is the watchdog log:
Comment #8
zbberlin commentedThe 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
Comment #9
sumit-k commentedReplicated 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:
Comment #10
coaston commentedI 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. Does not matter if I use views or default display mode and change widget. It seems this module is not D10 ready.
Comment #11
maxilein commentedIt 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.
Comment #12
erichomanchuk commentedIt 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.
Comment #13
wturrell commentedI 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…
Comment #14
rabindrakumar commentedAm 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?
Comment #15
zbberlin commentedI 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
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:
Attempts to Fix / Workarounds Tried
$('.pq-editablefields-form').attr('action', '/start');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 handlerOr determine the canonical route for the entity being edited, rather than relying on
\Drupal::request()->getRequestUri().Comment #16
zbberlin commentedComment #17
aaronbaumanSuggestion 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.
Comment #20
heyyo commentedWith 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.
Comment #21
heyyo commented