this is my code
<?php
$data = GeTpers::find()
->asArray()
->all();
$niceData = yii\helpers\ArrayHelper::map($data, 'pers_auxi',
function($element){
return $element['pers_nom1'] ." ". $element['pers_nom2'] ." ". $element['pers_ape1'] ." ". $element['pers_ape2'] ." ". $element['pers_ndoc'] ;
});
/* print_r($niceData); => Array ( [1] => ERICK DAYAN MARTINEZz GOMEZ 1098694780 [2] => LAURA PATRICIA CONTRERAS GARCIA 1098694752 )*/
?>
<?php
echo $form->field($model, 'pers_auxi')->widget(Typeahead::classname(), [
'dataset' => [
[
'local' => $niceData,
'limit' => 10
]
],
'pluginOptions' => ['highlight' => true],
'options' => ['placeholder' => 'Seleccione un Tercero...'],
]);
?>
when i print_r($niceData); => Array ( [1] => ERICK DAYAN MARTINEZz GOMEZ 1098694780 [2] => LAURA PATRICIA CONTRERAS GARCIA 1098694752 ) this works fine but when i save the form my pers_auxi is 0 everytime Any idea how to keep my id in this case is pers_auxi ?