mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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
This commit is contained in:
parent
ca4030df12
commit
5039273e75
@ -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();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user