Permalink
Browse files

BUGFIX Fixed TreeMultiselectField/TreeDropdownField saving with 'unch…

…anged' default values from constructor

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@99581 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 26ca64a commit fcfccf62316fc3fb30ca3923b1655e5543e21100 @chillu chillu committed Feb 22, 2010
Showing with 6 additions and 2 deletions.
  1. +2 −0 forms/TreeDropdownField.php
  2. +4 −2 forms/TreeMultiselectField.php
@@ -160,6 +160,8 @@ public function tree(SS_HTTPRequest $request) {
if($forceValues = $this->value) {
if(($values = preg_split('/,\s*/', $forceValues)) && count($values)) foreach($values as $value) {
+ if(!is_numeric($value)) continue;
+
$obj->markToExpose($this->objectForKey($value));
}
}
@@ -39,19 +39,21 @@ function Field() {
// needed for errorMessage()
Requirements::javascript(SAPPHIRE_DIR . '/javascript/LeftAndMain.js');
Requirements::javascript(SAPPHIRE_DIR . "/javascript/TreeSelectorField.js");
-
+
// Any field values have priority over the relation getters
if($this->value) {
$items = new DataObjectSet();
$ids = explode(',', $this->value);
foreach($ids as $id) {
+ if(!is_numeric($id)) continue;
+
$item = DataObject::get_by_id($this->sourceObject, $id);
if($item) $items->push($item);
}
} else {
$items = $this->getItems();
}
-
+
if($items && $items->Count()) {
foreach($items as $item) {
$titleArray[] =$item->Title;

0 comments on commit fcfccf6

Please sign in to comment.