mjonutz
(Ionut Fbi12)
1
I want to use the autocomplete widget with the following code:
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'name'=>'test',
'source'=>array('php', 'sql', 'yii'),
));
If i search for php, for example and is found, then i want to redirect to the url: /php. How can i achieve this? Thanks.
jayant
(Codesutras)
2
I guess you can do this task by calling a javascript function on select Option of CJuiAutoComplete
'select'=>'js:function() {
//do what ever you want..
}'
mjonutz
(Ionut Fbi12)
3
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'name'=>'test',
'source'=>array('php', 'sql', 'yii'),
'select'=>'js:function() {
//do what ever you want..
}'
));
i get the following error: Property "CJuiAutoComplete.select" is not defined.
jayant
(Codesutras)
4
Yes exactly…select is not any property of a CJuiAutocomplete…
you should use it in Options array…Like this
'options' => array(
'minChars'=>3,
'autoFill'=>false,
'focus'=> 'js:function( event, ui ) {
$( "#test_autocomplete" ).val( ui.item.name );
return false;
}',
'select'=>'js:function( event, ui ) {
$("#'.CHtml::activeId($model,'attribute_id').'")
.val(ui.item.id);
return false;
}'
),
Or refer this Link for more information.
mjonutz
(Ionut Fbi12)
5
I want to catch the value of the id selected. If i try to output in the select event, alert(ui.item.id); then i get undefined.