H
H
hollanditkzn2018-03-05 10:38:04
Yii
hollanditkzn, 2018-03-05 10:38:04

How to save or display in the kladr database not the id but the name of the city, street and house?

I use the kladr widget because it seemed more convenient, but I need not to save the id in the database, because the id is displayed there, namely the name of the street, city, and so on.
That is, with this code

<?= $form->field($model, 'street')->widget(Kladr::className(), [
            'type' => Kladr::TYPE_STREET,
            'options' => [
                'placeholder' => 'Улица',
                'class' => 'form-control'
            ]
        ])->label(false) ?>

I get 16000001000012000 in the database, but I don't need to get its id.
There is of course an assumption like making jquery and displaying value in another hidden field. Or is it possible to implement this method in some other way?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question