Browse files

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.
  • Loading branch information...
1 parent ac59895 commit 3156e75548526ca2119cde0ec095481262ba2cd4 @chillu chillu committed Jul 18, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 admin/javascript/LeftAndMain.js
6 admin/javascript/LeftAndMain.js
@@ -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 = $'form') ? 'CurrentForm' : 'Content';
+ newFragments[guessFragment] = $data;
// Replace each fragment individually

4 comments on commit 3156e75


Is it possible that this change causes problems with the Navigation in the CMS?
See this Forum Post for a detailed description and screenshots of the problem:

SilverStripe Ltd. member

Could well be. It's the cause of which looks similar

I'm working on a fix now.


Wow, that was damn fast!

Jep, seems to bee the same!
I tried with git bisect to locate the correct revision and this is the first one with the Bug.

SilverStripe Ltd. member

Cool. There's a fix in branches/3.0 and branches/3.0.1 now - let me know if that doesn't fix your issue.

Please sign in to comment.