Hi guys,
I am having a hard time getting the autocompletion to work as CJuiAutoComplete widget. I a, using Yii 1.7, and this is the widget code:
<?php
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
//'model'=>$model,
//'attribute'=>'name',
'id'=>'country-multiple',
'name'=>'country_multiple',
'source'=> array('one', 'two', 'three'),
'options'=>array(
'delay'=>300,
'minLength'=>2,
'showAnim'=>'fold',
'select'=>"js:function(event, ui) {
var terms = split(this.value);
// remove the current input
terms.pop();
// add the selected item
terms.push( ui.item.value );
// add placeholder to get the comma-and-space at the end
terms.push('');
this.value = terms.join(', ');
return false;
}"
),
'htmlOptions'=>array(
'size'=>'40'
),
));
?>
I will use an ajax request, but want to make it work with a more simple source first. Anyways, as you can see I want to use multiple selections, and the values of the source is showing as expected. The problem occurs if I want to select one from the list, either by mouse or keyboard.
The error I get is: Error: split is not defined Source File: http://localhost/site/test Line: 260
So it is an JS error, but how can I fix it? As far as I know the widgets handle their own assets.
Any help is much appreciated as I have wasted alot of time this far:-)
Cheers,
OM