[SOLVED] CAutoComplete setting up assistance.

Good evening,

I am attempting to use the CAutoComplete widget but I am having a difficult time understanding what I should be placing within the 'url' setting. It is mentioned within the forums that it should be 'controller/action'. I would like to know the correct way to fill in that setting:

I'd also like to give an example of how I setup my application:

There is a module 'SuperMario' with a controller 'Games'. Within the controller I used the AutoCompleteLookup function directly from the cookbook and set up my database accordingly:

In this case, Users is a model outside of module, specifically within the main application.

This is probably something very simple and I may be over-complicating the issue. Please also let me know if I missed anything, thank you.

if your view is used in the same controller

Yii::app()->createUrl('AutoCompleteLookup')

if this doesn't work you can also try

Yii::app()->createUrl('games/AutoCompleteLookup')

and if that doesn't help the name of the module

Yii::app()->createUrl('supermario/games/AutoCompleteLookup')

but the first should work

EDIT:

OOPS I forgot something ;)

It must be $this->createUrl('AutoCompleteLookup') when you use it in a controller view to create the url to the controller action function.

Yii:app() would create one from the root, so the things above doesn't work except the last one.

Interesting. I forgot to mention that my view is separated by the controller:

So the view file 'userlist.php' would contain "$this->widget('CAutoComplete',…".

I will try to get your method working, horizons. In the meantime, would the way that I setup my files work?

Thanks again.

Man, after a few days of this, I was getting ready to chuck something out the window. This is for the view in case anyone has a difficult time understanding what to enter:

<?php echo $this->widget('CAutoComplete',


          array(


             'name'=>'username', 


             'url'=>array('games/autoCompleteLookup'),...


And the final thing that got it going was…I forgot to 'Allow' the view 'autoCompleteLookup' in the controller. I need more sleep.

Thanks again, horizon, all is good now.