I am trying to use yii2 Jui autocomplete widget.
I have this code which is showing the auto-complete date correctly, but I am not able to save the data.
$data=ArrayHelper::map(State::find()->all(), 'id', 'state_name' );
$data=array_merge($data);
And then
echo 'State' .'<br>';
echo AutoComplete::widget([
'model'=>$model,
'attribute' => 'state_id',
'clientOptions' => [
'source' => $data,
],
]);
Any solution will be greatly appreciated. Thanks.
Ok I found the solution, it goes like this:
Then:
Then
and Finally:
That is all. Hope some one will find it useful. Thanks.