I’m screwed. I have no idea how to go on from now with that whole AutoCompletion Desaster…
What I would like to do:
I have searchform in the sidebar. You should be able to type in some letters and CJuiAutoComplete is doing it’s job.
When you selected a suggested item from a list and hit ENTER a search should be initiated with the selected value.
Sounds easy… but it isn’t.
What is working:
I followed the Playground-instructions and yes, it works like a charm. There are appearing items during typing into the input-box. And yes, I can select those items. Pretty cool!
What isnt’ working:
The code for some explanation
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'name'=>'username',
'value'=>'',
'source'=>$this->createUrl('user/autoComplete'),
// additional javascript options for the autocomplete plugin
'options'=>array(
'showAnim'=>'fold',
'select' => 'js:function(event, ui){ alert("Selected " + ui.item.id); }'
),
));
As you can see, I putted in a select Event. The function is just for debugging and it says "undefined".
Thats Problem number 1. Why does it says its undefinded? I guess it’s because I missed something.
I do have a controlleraction called actionIndex (user/index - which resides in the UserController.php as the actionAutoComplete).
What I would like to do is to pump the selected item via _GET into the actionIndex because there is the Code to render a search-view etc. doinf all the $model stuff.
So I just dont get it to work in that way and I have no idea after hours of research and try and error.
Maybe someone has any idea…
Thanks a lot.