Yii 1.1: multicomplete

CJuiAutoComplete wrapper to create multi tags input field with any splitter, and autocomplete

Multitagging autocomletion wrapper for CJuiAutoComplete.


Yii Framework >= 1.1.2


Insert following code into view

<?php $this->widget('path.to.multicomplete.MultiComplete', array(
          //'source'=>array('ac1', 'ac2', 'ac3'),
          // additional javascript options for the autocomplete plugin

if you want to use static source - you must use source Option, if you want to get tags dynamically you must specify sourceUrl option, and use the following code in controller:

public function actionSearch()
     { //completion variants
      echo '[ 

How to get tags from a model

public function actionSearch($term)
          if(Yii::app()->request->isAjaxRequest && !empty($term))
              $variants = array();
              $criteria = new CDbCriteria;
              $tags = tagsModel::model()->findAll($criteria);
                foreach($tags as $tag)
                    $variants[] = $tag->attributes['tag'];
              echo CJSON::encode($variants);
            throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');

Additional options

splitter(string) - tag splitter to parse tag input string


Multicomplete screenshot


Total 5 comments

#16046 report it
CrazyCat at 2014/01/14 10:32am
What about many_many relations ?

Hello there,

I want to use this extension with a many_many relation, but it doesn't work because my field contains an array of objects and not a string value.

Peharps have I to add a small hack to check the attribute type and transform it in a comma separated string if it's an array ?

#12217 report it
samilo at 2013/03/07 07:38am
suggestion to devlope in future

Hi thank u . I suggest to develop it related to Gridview filter , Then will be perfect ext .

#7759 report it
lvil at 2012/04/16 03:30am
Thank you

1 minute implementation, simple usage, great extension. Thank you!

#5940 report it
szako at 2011/11/27 01:52pm

Thanks, that's what I needed!

#2279 report it
robregonm at 2010/12/06 09:22am

Excellent idea. I'll give it a try... ;)

Leave a comment

Please to leave your comment.

Create extension