Permalink
Browse files

BUGFIX Avoid reloading CMS form twice after certain saving actions (f…

…ixes #5451, thanks muzdowski)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@113692 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent c19aa2c commit e8e5c62c5ad9c55418708be927732c7dadbe1343 @chillu chillu committed with sminnee Nov 13, 2010
Showing with 5 additions and 3 deletions.
  1. +5 −3 code/LeftAndMain.php
View
@@ -732,7 +732,8 @@ public function save($urlParams, $form) {
// Removed virtualpage test as we need to draft/published links when url is changed
if( (/*$record->class == 'VirtualPage' &&*/ $originalURLSegment != $record->URLSegment) ||
($originalClass != $record->ClassName) || self::$ForceReload == true) {
- FormResponse::add("$('Form_EditForm').getPageFromServer($record->ID);");
+ // avoid double loading by adding a uniqueness ID
+ FormResponse::add($str = "$('Form_EditForm').getPageFromServer($record->ID);", $str);
}
// After reloading action
@@ -765,7 +766,8 @@ public function save($urlParams, $form) {
// If there has been a change in the broken link values, reload the page
if ($originalBrokenLinkValues != $record->HasBrokenLink.$record->HasBrokenFile) {
- FormResponse::add("$('Form_EditForm').getPageFromServer($record->ID);");
+ // avoid double loading by adding a uniqueness ID
+ FormResponse::add($str = "$('Form_EditForm').getPageFromServer($record->ID);", $str);
}
// If the 'Save & Publish' button was clicked, also publish the page
@@ -1305,4 +1307,4 @@ static function require_themed_css($name, $media = null) {
}
-?>
+?>

0 comments on commit e8e5c62

Please sign in to comment.