Skip to content

Commit

Permalink
BUG Redisplay CMS forms with validation errors
Browse files Browse the repository at this point in the history
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
chillu committed Jul 18, 2012
1 parent ac59895 commit 3156e75
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions admin/javascript/LeftAndMain.js
Expand Up @@ -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
Expand All @@ -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
Expand Down

4 comments on commit 3156e75

@jrast
Copy link
Contributor

@jrast jrast commented on 3156e75 Jul 26, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: http://www.silverstripe.org/customising-the-cms/show/20470

@hafriedlander
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could well be. It's the cause of http://open.silverstripe.org/ticket/7702 which looks similar

I'm working on a fix now.

@jrast
Copy link
Contributor

@jrast jrast commented on 3156e75 Jul 26, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@hafriedlander
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.