A
A
Alexander Verbitsky2022-01-18 07:28:22
Yii
Alexander Verbitsky, 2022-01-18 07:28:22

Why doesn't validation work when I change id in Select2?

If you set your id to Select2, then the validation that you specified in the rules stops working... Without this id, everything works, and if, for example, the field is empty, it is highlighted in red, but not with id. What is it connected with? I must say right away that I definitely need another id.

<?= $form->field($a_model, 'regions')->widget(
    Select2::classname(), [
        'options' => [
            'id' => 'tp_addresses-regions',
        ],
    ])
?>

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