Permalink
Browse files

BUGFIX TreeMultiselectField_Readonly now posts the correct value to t…

…he server (from r97100) (from r98150)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102618 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 87990bd commit 64da35bca534a90eeeecade4f2c2823e86c1008a @chillu chillu committed Apr 13, 2010
Showing with 12 additions and 5 deletions.
  1. +12 −5 forms/TreeMultiselectField.php
@@ -133,16 +133,23 @@ class TreeMultiselectField_Readonly extends TreeMultiselectField {
protected $readonly = true;
function Field() {
- $titleArray = array();
- $titleList = array();
+ $titleArray = $itemIDs = array();
+ $titleList = $itemIDsList = "";
if($items = $this->getItems()) {
foreach($items as $item) $titleArray[] = $item->Title;
+ foreach($items as $item) $itemIDs[] = $item->ID;
if($titleArray) $titleList = implode(", ", $titleArray);
+ if($itemIDs) $itemIDsList = implode(",", $itemIDs);
}
-
- $field = new ReadonlyField($this->name, $this->title);
+
+ $field = new ReadonlyField($this->name.'_ReadonlyValue', $this->title);
$field->setValue($titleList);
$field->setForm($this->form);
- return $field->Field();
+
+ $valueField = new HiddenField($this->name);
+ $valueField->setValue($itemIDsList);
+ $valueField->setForm($this->form);
+
+ return $field->Field().$valueField->Field();
}
}

0 comments on commit 64da35b

Please sign in to comment.