-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom page's validation message doesn't display when the page is loaded via ajax #2230
Comments
@phalkunz Can you run |
@chillu The version is |
I just gave it a go on 4.2.1. Everything seems to be working as expected for me. Here's what it looks like for me https://youtu.be/n0slMPKzHBs Am I doing something wrong? |
@maxime-rainville I think your steps to reproduce it is correct. Do you mind leaving it open for a week or so? I'll take make a note to test it again. |
Sure thing. |
@maxime-rainville Just gave it a try. Turned out if you log out and log back into you won't see the validation message on publishing the page. I'll update to the steps to reproduce it. |
I tried logging in and logging out like you did. But I still can't see it 😞 Are you seeing anything in the JS console log? Could you have a look at the network tab in your browser's dev tool and show me the HTTP request for the Save action? |
Request header:
Form data:
|
I think I'm getting it now. I was testing on a plain SS4 installed. I switch to testing it on CWP kitchen sink, which seems to bring out the issue. Basically, the request and response we're getting back is fine. It just looks like the front end is not doing anything with it. |
I think I found where the problem is. For some reason on this jQuery.ajax(jQuery.extend({
headers: {"X-Pjax" : "CurrentForm,Breadcrumbs"},
url: form.attr('action'),
data: formData,
type: 'POST',
complete: function() {
clearButton()
},
success: function(data, status, xhr) {
clearButton();
form.removeClass('changed'); // TODO This should be using the plugin API
if(callback) callback(data, status, xhr);
var newContentEls = self.handleAjaxResponse(data, status, xhr);
if(!newContentEls) return;
newContentEls.filter('form').trigger('aftersubmitform', {status: status, xhr: xhr, formData: formData});
}
}, ajaxOptions)); |
I think I found the problematic module that's breaking things. It's I had a similar problem a few month ago with that specific bit of code while trying to implement a lazy loadable gridfield. |
silverstripe/silverstripe-admin#769 will provide a fix that allows admin to be more resilient to AJAX errors. @bergice Did you investigate what the issue with |
That PR is merged, does it resolve this? |
There's still an issue with |
Outstanding points have been split into silverstripe/silverstripe-gridfield-bulk-editing-tools#188 |
This is possibly an issue in the admin module. This happens when you load a custom page with required fields via ajax. On saving/publishing, the required field messages and the central warning message do not show up.
If you, however, select the custom page and reload the CMS, the validation messages work as expected.
Step to reproduce:
Pull Requests
The text was updated successfully, but these errors were encountered: