V
V
Vladislav Sofienko2017-09-04 17:21:07
Yii
Vladislav Sofienko, 2017-09-04 17:21:07

How to create a validated form with dynamic radio button groups?

I'm interested in a few things.
1) How to dynamically populate a group of radio buttons (radioList) of this type:

$form->field($model, 'radioButtonList')
    ->radioList([
        '1' => 'Первый',
        '2' => 'Второй',
        '3' => 'Третий'
    ]);

2) Since these radiolists are also dynamic through the loop, how to validate them? For example, the fact that in all radiolists the user has selected an item?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Fedorov, 2017-09-05
@sofvlad

use Dynamic Model

M
Maxim Timofeev, 2017-09-04
@webinar

1) What do you mean by "dynamically"?
2) For this there is a validator each

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question