A
A
Alexander Verbitsky2022-04-08 07:00:37
Yii
Alexander Verbitsky, 2022-04-08 07:00:37

Why does validation in radioList stop working if I set my own 'tag'?

By default, the "tag" parameter is "div", in which case the validation works well, if nothing is selected from the list, then a warning appears, and if selected, it lights up green.

But if you set another tag, then it swears in both cases, whether I chose a value or not ....

How to set up validation so that everything works?

<?= $form->field($model, 'model_param')
    ->radioList($array,
        [
            'tag' => 'section',
            'item' => function ($index, $label, $name, $checked, $value) {
                return Html::radio($name,
                    $checked,
                    [
                        'value' => $value,
                        'label' => $label
                    ]
                );
            },
        ]
    )
?>


It's just that my buttons are wrapped in table tags, (tbody, tr, td) and the selection of any position does not give any results...
624fb35cdca0c185444764.png

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