diff --git a/forms/TreeMultiselectField.php b/forms/TreeMultiselectField.php index 0fa7bb735..b4c933e81 100755 --- a/forms/TreeMultiselectField.php +++ b/forms/TreeMultiselectField.php @@ -85,16 +85,22 @@ HTML; * Changes this field to the readonly field. */ function performReadonlyTransformation() { + return new TreeMultiselectField_Readonly($this->name, $this->title, $this->sourceObject, $this->keyField, $this->labelField); + } +} + +class TreeMultiselectField_Readonly extends TreeMultiselectField { + function Field() { $titleArray = array(); $titleList = array(); if($items = $this->getItems()) { foreach($items as $item) $titleArray[] = $item->Title; if($titleArray) $titleList = implode(", ", $titleArray); } - + $field = new ReadonlyField($this->name, $this->title); $field->setValue($titleList); $field->setForm($this->form); - return $field; + return $field->Field(); } -} \ No newline at end of file +} \ No newline at end of file