Yii, forms, and AJAX auto suggest

Hi there,

I’m new to Yii and I’m trying to set up a form with an auto suggest feature on one of the textfields. I have set up the form ok and it works well, but now I’m wondering if there are any tutorials out there, or if anyone can point me in the right direction, on the best way to integrate an AJAX auto suggest on the main textfield. I’d be pulling the auto suggest options out of a mysql database.

Thanks

Em

have a look at these,

http://www.yiiframework.com/doc/api/1.1/CJuiAutoComplete

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

Hi again,

Thanks for that, but I still cant seem to get it working. Is jquery already running on yii or do I have to call it? Sorry for being such a noob, just i really am stuck on this one.

Em

It is by default, all CJui widgets include whats needed for it to run

renderPartial will not add the scripts tho, only render

check firebug to see whats is going on, if it does an ajax request or what

Hi,

Ok i have tried all that and nothing, I think im missing something but i dont know what and I am desperate now for help!! I get as far as the form showing, the name i assign showing, but then if i try and use the ajax autocomplete nothing drops down and there is nothing to select.

I have tried duplicating the yii playground examples and the bird one that Alex W suggested and still the same lack of anything. Please someone help before I pull all my hair out lol.

Em

Here is a practical example about how to use autocomplete