Fix select and select_ajax FormValidator's elements

1.10.x
Angel Fernando Quiroz Campos 10 years ago
parent 5ce87cd31f
commit b773f6498d
  1. 22
      main/inc/lib/formvalidator/Element/SelectAjax.php
  2. 3
      main/inc/lib/pear/HTML/QuickForm/select.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
</script>
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;
}
}

@ -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 . '<select data-live-search="true" ' . $attrString . ">\n";
$strHtml .= $tabs . '<select ' . $attrString . ">\n";
$strValues = is_array($this->_values)? array_map('strval', $this->_values): array();

Loading…
Cancel
Save