Hello Friends,
I tried to use multicomplete extension but mesh-up with it.
As in the documentation, to access data dynamically it suggest to use ‘sourceUrl’ but it targets for a new page instead of user define method/function.
<?php $this->widget('path.to.multicomplete.MultiComplete', array(
'model'=>$model,
'attribute'=>'news_tags',
'splitter'=>',',
//'source'=>array('ac1', 'ac2', 'ac3'),
'sourceUrl'=>'search.html',
// additional javascript options for the autocomplete plugin
'options'=>array(
'minLength'=>'2',
),
'htmlOptions'=>array(
'size'=>'60'
),
));
?>
Does it have restriction to define function instead of page name (as search.html)?
And in the next code provided by the documentation:
{
if(Yii::app()->request->isAjaxRequest && !empty($term))
{
$variants = array();
$criteria = new CDbCriteria;
$criteria->select='tag';
$criteria->addSearchCondition('tag',$term.'%',false);
$tags = tagsModel::model()->findAll($criteria);
if(!empty($tags))
{
foreach($tags as $tag)
{
$variants[] = $tag->attributes['tag'];
}
}
echo CJSON::encode($variants);
}
else
throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
}
what does the variable $term represent??