How Autocomplete For Tags?


I had implemented autocomplete for tags from

Simple way to use AutoComplete using different ID and Display Value

It is works fine, but the problem with the separator (-) , when I enter one word the code will find the related, but like this:


will not find anything, how to search each word ?


Any idea guys?

I didn’t get it. What’s the problem?

Quick look at your link:

$sql= 'SELECT id ,title AS label FROM users WHERE title LIKE :name';

$name = $name.'%';

Maybe you need something like this:

$name = '%'.$name.'%';

or something else.

Anyway, don’t be afraid of getting your hands dirty and write some code. Programming is not about ‘is there any extension for Yii’.


I mean when admin enter first tag name the action will find and show it as autocomplte, but when admin add the tag separator the action will search for the whole input …

for example: writing yahoo ( action will search for yahoo), then second tag : yahoo-web … the action will search the database for "yahoo-web" not for web only !!

however, I found the solution from YII wiki :)