From b773f6498de319736745340484dcff9f5518dc46 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Mon, 28 Sep 2015 14:26:10 -0500 Subject: [PATCH] Fix select and select_ajax FormValidator's elements --- .../lib/formvalidator/Element/SelectAjax.php | 22 ++++--------------- main/inc/lib/pear/HTML/QuickForm/select.php | 3 ++- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/main/inc/lib/formvalidator/Element/SelectAjax.php b/main/inc/lib/formvalidator/Element/SelectAjax.php index ef6dca4f78..efa1f67aea 100644 --- a/main/inc/lib/formvalidator/Element/SelectAjax.php +++ b/main/inc/lib/formvalidator/Element/SelectAjax.php @@ -42,9 +42,6 @@ class SelectAjax extends HTML_QuickForm_select templateSelection : '.$formatResult; } - $defaultValues = $this->getAttribute('defaults'); - $defaultValues = empty($defaultValues) ? [] : $defaultValues; - $width = 'element'; $givenWidth = '100%'; if (!empty($givenWidth)) { @@ -100,24 +97,13 @@ class SelectAjax extends HTML_QuickForm_select JS; + $this->removeAttribute('formatResult'); + $this->removeAttribute('minimumInputLength'); + $this->removeAttribute('placeholder'); $this->removeAttribute('class'); $this->removeAttribute('url'); $this->setAttribute('style', 'width: 100%;'); - $attrs = $this->getAttributes(); - - $selectName = $this->getAttribute('name'); - - if ($this->getAttribute('multiple')) { - $selectName = "{$this->getAttribute('name')}[]"; - } - $html .= Display::select( - $selectName, - $defaultValues, - array_keys($defaultValues), - $attrs, - false - ); - return $html; + return parent::toHtml() . $html; } } diff --git a/main/inc/lib/pear/HTML/QuickForm/select.php b/main/inc/lib/pear/HTML/QuickForm/select.php index f999ea9318..2d874e034a 100755 --- a/main/inc/lib/pear/HTML/QuickForm/select.php +++ b/main/inc/lib/pear/HTML/QuickForm/select.php @@ -87,6 +87,7 @@ class HTML_QuickForm_select extends HTML_QuickForm_element $oldClass = $attributes['class']; } $attributes['class'] = $oldClass . ' selectpicker show-tick form-control'; + $attributes['data-live-search'] = 'true'; } $columnsSize = isset($attributes['cols-size']) ? $attributes['cols-size'] : null; $this->setColumnsSize($columnsSize); @@ -550,7 +551,7 @@ class HTML_QuickForm_select extends HTML_QuickForm_element $this->setName($myName); } - $strHtml .= $tabs . '\n"; $strValues = is_array($this->_values)? array_map('strval', $this->_values): array();