How to show a search box inside a 'list' type of form field?

enter image description here

1 Answer 1


You need to load chosen plugin to style list box fields like this.

Load chosen plugin first in your form layout file so that it can add style to your select boxes

JHtml::_('formbehavior.chosen', 'select');

Add following class name to your form field (optional if you want to color it as mandatory field)


To render the field on your form page:

<div class="control-group">
   <div class="control-label">
      <?php echo $this->form->getLabel('fieldname'); ?>
   <div class="controls">
     <?php echo $this->form->getInput('fieldname'); ?>

Note: The search box will be shown inside the listbox if there are 10 or more options inside it. See the below sample jQuery code that will be added by Joomla.


To override it, change your chosen loading code to following:

JHtml::_('formbehavior.chosen', 'select', null, array('disable_search_threshold'=>1));
  • I already have this included and it doesn't show the search box inside the list. May 16, 2015 at 16:51
  • What is the type of form field you are using in your form filter xml file?
    – Nagarjun
    May 16, 2015 at 17:31
  • list the problem is not inside the filter. Inside the filter the list shows the search box. But when I show a similar list type of field in the form using getControlGroup doesn't show the search box. May 16, 2015 at 17:36
  • I guess the number of options inside the listbox is less than 10. The search box automatically shows if its more than 10.
    – Nagarjun
    May 16, 2015 at 17:54
  • See my answer now, to know how you can override it
    – Nagarjun
    May 16, 2015 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.