Hi.
I’m using yii2-widget-typeaheadbasic from https://github.com/kartik-v/yii2-widget-typeahead
I’m using this extension in form.
How to return id, not name.
For get data I use arrayhelper map
I try:
<?= $form->field($model, 'top_id')->widget(TypeaheadBasic::classname(), [
'data' => \yii\helpers\ArrayHelper::map(\app\models\Surname::find()->all(), 'id', 'name'),
'pluginOptions' => ['highlight' => true],
'options' => ['placeholder' => 'surname'],
]); ?>
but always I have "0" from this input field