Skip to content
This repository
Browse code

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...
commit 3156e75548526ca2119cde0ec095481262ba2cd4 1 parent ac59895
Ingo Schommer authored July 18, 2012

Showing 1 changed file with 4 additions and 2 deletions. Show diff stats Hide diff stats

  1. 6  admin/javascript/LeftAndMain.js
6  admin/javascript/LeftAndMain.js
@@ -328,7 +328,7 @@ jQuery.noConflict();
328 328
 			 * Can be hooked into an ajax 'success' callback.
329 329
 			 */
330 330
 			handleAjaxResponse: function(data, status, xhr) {
331  
-				var self = this, url, selectedTabs;
  331
+				var self = this, url, selectedTabs, guessFragment;
332 332
 
333 333
 				// Pseudo-redirects via X-ControllerURL might return empty data, in which
334 334
 				// case we'll ignore the response
@@ -343,7 +343,9 @@ jQuery.noConflict();
343 343
 					newFragments = data;
344 344
 				} else {
345 345
 					// Fall back to replacing the content fragment if HTML is returned
346  
-					newFragments['Content'] = data;
  346
+					$data = $(data);
  347
+					guessFragment = $data.is('form') ? 'CurrentForm' : 'Content';
  348
+					newFragments[guessFragment] = $data;
347 349
 				}
348 350
 
349 351
 				// Replace each fragment individually

4 notes on commit 3156e75

Juerg Rast
jrast commented on 3156e75 July 26, 2012

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

Hamish Friedlander
Owner

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

I'm working on a fix now.

Juerg Rast
jrast commented on 3156e75 July 26, 2012

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.

Hamish Friedlander
Owner

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.
Something went wrong with that request. Please try again.