From 5039273e75b45d382f8a7460cf16f1174b043576 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Thu, 4 Feb 2010 04:29:21 +0000 Subject: [PATCH] BUGFIX TreeMultiselectField_Readonly now posts the correct value to the server (from r97100) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@98150 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/TreeMultiselectField.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/forms/TreeMultiselectField.php b/forms/TreeMultiselectField.php index f2bfca7fc..4a6a9d90a 100755 --- a/forms/TreeMultiselectField.php +++ b/forms/TreeMultiselectField.php @@ -111,16 +111,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(); } } \ No newline at end of file