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:
Ingo Schommer 2012-07-18 16:49:03 +02:00
parent ac5989560e
commit 3156e75548

View File

@ -328,7 +328,7 @@ jQuery.noConflict();
* Can be hooked into an ajax 'success' callback. * Can be hooked into an ajax 'success' callback.
*/ */
handleAjaxResponse: function(data, status, xhr) { 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 // Pseudo-redirects via X-ControllerURL might return empty data, in which
// case we'll ignore the response // case we'll ignore the response
@ -343,7 +343,9 @@ jQuery.noConflict();
newFragments = data; newFragments = data;
} else { } else {
// Fall back to replacing the content fragment if HTML is returned // 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 // Replace each fragment individually