views:

35

answers:

1

Hi,

I want to use the autocomplete component for cakephp but instead of just autocompleting one value in a textfield i want it to work like SOF tags. i.e. one tag, 2nd tag, ...

Does anyone know if there is an option for this using this component?

thanks,

Jonesy

+1  A: 

You should look at using jQuery UI Autocomplete, which has a demo of this functionality here:

http://jqueryui.com/demos/autocomplete/#multiple

You should not need a Cake component for this, just include the jQuery code to do what you want, and attach it to a regular Cake form field. You can either include the values in the script when it loads, or return them from a controller method (using the RequestHandler to return JSON).

handsofaten
thanks for your answer, can I add a PHP array into the availableTags variable?
iamjonesy
No problem. Yes, actually, Cake has a built-in function to convert a PHP array into a JS object: `$this->Js->object($your_array)`. Look at http://book.cakephp.org/view/1593/Methods
handsofaten