From d9f4a362d7b84911b108c0eb395be02ab60f1a11 Mon Sep 17 00:00:00 2001 From: jean Date: Tue, 19 Mar 2013 08:48:44 +1300 Subject: [PATCH] FIX #8328 Expose previously selected values of TreeMultiSelectField so they are not wipped out when selecting more values at an higher level in hierarchy --- forms/TreeMultiselectField.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/forms/TreeMultiselectField.php b/forms/TreeMultiselectField.php index e8c53a299..caf0303e6 100644 --- a/forms/TreeMultiselectField.php +++ b/forms/TreeMultiselectField.php @@ -115,13 +115,20 @@ class TreeMultiselectField extends TreeDropdownField { $title = _t('DropdownField.CHOOSE', '(Choose)', 'start value of a dropdown'); } + $dataUrlTree = ''; + if ($this->form){ + $dataUrlTree = $this->Link('tree'); + if (isset($idArray) && count($idArray)){ + $dataUrlTree .= '?forceValue='.implode(',',$idArray); + } + } return FormField::create_tag( 'div', array ( 'id' => "TreeDropdownField_{$this->id()}", 'class' => 'TreeDropdownField multiple' . ($this->extraClass() ? " {$this->extraClass()}" : '') . ($this->showSearch ? " searchable" : ''), - 'data-url-tree' => $this->form ? $this->Link('tree') : "", + 'data-url-tree' => $dataUrlTree, 'data-title' => $title, 'title' => $this->getDescription() ),