Allows you to create field that allows multiple selection of records, such as tags, compliant with Bootstrap 3

Installs: 12 502

Dependents: 0

Suggesters: 0

Security: 0

Stars: 6

Watchers: 4

Forks: 6

Open Issues: 4



dev-master 2015-01-05 23:39 UTC

This package is auto-updated.

Last update: 2024-03-29 02:31:11 UTC


Creates a field that allows multiple selection, like a CheckboxSetField to store in a many_many, has_many, or native field (as comma separated values) and provides typeahead searching with prefetching and caching on a given result set. Useful for multiple selection of a densely populated data set, like tags.

This field is only for frontend forms using the Bootstrap framework. It will not render properly in the CMS.




composer require unclecheese/bootstrap-tagfield:dev-master


  • silverstripe/framework 3.1.*
  • unclecheese/bootstrap-forms 1.1.*


A simple tag field that queries against a list of all Tag records.

BootstrapTagField::create('Tags', 'Add some tags below', Tag::get());

This field is not only for tags. It can be used as a replacement for checkboxes when the data set is large.

  'Add categories to your product', 
    ->filter('Available', true)

Optional arguments

Set the field to be used as the label (e.g. the text of a checkbox field). Defaults to Title.

BootstrapTagField::create('Tags', 'Add some tags below', Tag::get(), 'Name');

Set the field to be used as the ID of the option (e.g. the value that is stored in the database). Defaults to ID.

BootstrapTagField::create('Tags', 'Add some tags below', Tag::get(), 'Name', 'Slug');


You can optionally provide a SS_List to be loaded into the typeahead search to give immediate results. Once an actual query is made to the remote, the list is backfilled with any new results that come through.

Prefetch a list of popular tags:

BootstrapTagField::create('Tags', 'Add some tags below', Tag::get())
            ->leftJoin('Post_Tags', 'TagID = Tag.ID')                            
            ->alterDataQuery(function($query) {