I am new to php and yii framework. I want to do a dropdownlist with matching result. But if you want to type for example at least 3 or 4 letters to get result. If you type 3 numbers or letters the dropdownlist will open automatically and let you see all words/numbers that has the 3 letters/numbers consecutive.
I checked this site.
http://www.yiiframework.com/wiki/48/by-example-chtml/#hh5
But I dont know where I can set the condition for what I want to do. Thanks a lot.
In view page,
$term = CHtml::listData(Term::model()->findAll(), 'termid', 'term_name');//!< $term to select term details
echo CHtml::activeDropDownList($model, 'termid', $term, array(
'empty' => Yii::t('app','Select Term'), 'class' => "form-control",
));
have a look at http://yiiwheels.2amigos.us/ they have really good widgets that can help you. http://yiiwheels.2amigos.us/site/inputs#select2 will be of great help to you.
$term = CHtml::listData(Term::model()->findAll(), 'termid', 'term_name');
$this->widget('yiiwheels.widgets.select2.WhSelect2', array(
'asDropDownList' => true,
'model' => $model,
'attribute'=>'attribute'
'pluginOptions' => array(
'tags' => $term,
'placeholder' => 'type 2amigos',
'width' => '40%',
'tokenSeparators' => array(',', ' ')
)));
haven't tested it though,