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
- Download Select2 from http://ivaynberg.github.io/select2/.
Unzip it in the sites/all/libraries/select2 directory
(select2.js should be located in sites/all/libraries/select2).
Make sure you download the right version. Currently the 4.0.x branch isn't supported. We suggest to download this one: https://github.com/select2/select2/releases/tag/3.5.2 - Install as you would normally install a contributed drupal module. See:
https://drupal.org/documentation/install/modules-themes/modules-7
for further information.
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
- Add a field of type EntityReference or Term reference
- Select as widget Select2widget
- Configure / customize the widget if needed or simply continue since some defaults have been already set for your convenience.
- 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: Improve usability, accessibility, and scalability of long select lists
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.
The development of the 7.x-2.x branch was sponsored by Cylex
and is used in production JoZoo
Project information
- Module categories: Administration Tools, Site Structure, Developer Tools
- 491 sites report using this module
- Created by svipsa on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
bugfixes
Development version: 7.x-2.x-dev updated 5 Apr 2017 at 08:28 UTC