How to set the checked
attribute for a radio button generated by ActiveForm::radio()
:
echo $form->field( $model, 'radioButton' )->radio( [ 'checked' => 'checked', // or "'checked' => true" don't work ] );
The documentation for the ActiveForm::radio()
method says:
... ...
Maybe it stretches because of the incorrect use of this method by me, since I did not understand what the following means:
This method will generate the "checked" tag attribute value.
This method will generate the “checked” attribute according to the value of the model attribute.