Select2 Field Widget

Component ID

2044305

Component name

Select2 Field Widget

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

18572

Component created

Component changed

Component body

Select2 - The jQuery replacement for select boxes now available for Drupal fields.

This module provides a new Field widget for Entityreference and Term reference fields that allows users to use Select2 jQuery plugin.

Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.
http://ivaynberg.github.com/select2/

Dependencies

  • jQuery Update - will need jQuery version 1.7+
  • Libraries API - This module introduces a common repository for libraries in sites/all/libraries resp. sites/<domain>/libraries for contributed modules.

Demo

You can simply test this module using this web application.
OR
using this direct URL
http://simplytest.me/project/select2widget

Installation instructions

Known issues

The new release branch 4.0.x isn't yet supported.
See #2432769: Doesn't work with latest 4.0.0-beta.3
Make sure you download the right version. From here: https://github.com/select2/select2/releases/tag/3.5.2

How to use it

  1. Add a field of type EntityReference or Term reference
  2. Select as widget Select2widget
  3. Configure / customize the widget if needed or simply continue since some defaults have been already set for your convenience.
  4. Enjoy having a modern, beautiful and flexible drop-down / select box.

For further details read the README of the module.

Drupal 8

It looks this module or atleast the jQuery library has a good chance to get into the Drupal 8 core, replacing the current autocomplete system for terms. For more details follow these issues:

Issue from Drupal 8 core: #2346973: Replace jQuery UI autocomplete with Select2
Issue from the Select2 jQuery library on Github: https://github.com/ivaynberg/select2/issues/2499



Browser Compatibility

  • IE 8+
  • Chrome 8+
  • Firefox 10+
  • Safari 3+
  • Opera 10.6+

Credits

  • svipsa - Initial Development and maintainer
  • k_zoltan and the team from Cylex - Co-maintainer of the 2.x branch

Branch (7.x-2.x):

Has a widget for Entity Reference which allow use Views for render results for reference fields.

Has a widget to load results by AJAX.

If you are new to this module you should start with the 7.x-2.x branch.
IMPORTANT NOTE: there will be no upgrade path from the 7.x-1.x version.

select 2 widget demo

The development of the 7.x-2.x branch was sponsored by Cylex

and is used in production JoZoo