mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUG Redisplay CMS forms with validation errors
Guess the fragment based on the returned HTML. The validation error HTTP response is generated by Form rather than the controller (LeftAndMain), so we can't set custom PJAX headers easily.
This commit is contained in:
parent
ac5989560e
commit
3156e75548
@ -328,7 +328,7 @@ jQuery.noConflict();
|
||||
* Can be hooked into an ajax 'success' callback.
|
||||
*/
|
||||
handleAjaxResponse: function(data, status, xhr) {
|
||||
var self = this, url, selectedTabs;
|
||||
var self = this, url, selectedTabs, guessFragment;
|
||||
|
||||
// Pseudo-redirects via X-ControllerURL might return empty data, in which
|
||||
// case we'll ignore the response
|
||||
@ -343,7 +343,9 @@ jQuery.noConflict();
|
||||
newFragments = data;
|
||||
} else {
|
||||
// Fall back to replacing the content fragment if HTML is returned
|
||||
newFragments['Content'] = data;
|
||||
$data = $(data);
|
||||
guessFragment = $data.is('form') ? 'CurrentForm' : 'Content';
|
||||
newFragments[guessFragment] = $data;
|
||||
}
|
||||
|
||||
// Replace each fragment individually
|
||||
|
Loading…
x
Reference in New Issue
Block a user