yii2-bootstrap5 icon indicating copy to clipboard operation
yii2-bootstrap5 copied to clipboard

ActiveForm | Incorrect radioList HTML/CSS

Open vip9008 opened this issue 2 years ago • 0 comments

Incorrect HTML/CSS when rendering radioList field (ActiveForm) using LAYOUT_FLOATING

What steps will reproduce the problem?

use yii\bootstrap5\ActiveForm;

$form = ActiveForm::begin([
    'layout' => ActiveForm::LAYOUT_FLOATING,
]);
    // text fields are rendered as expected
    echo $form->field($model, 'from')->textInput(['autocomplete' => 'off', 'type' => 'date']);
    echo $form->field($model, 'to')->textInput(['autocomplete' => 'off', 'type' => 'date']);
    // radio list field shows incorrect HTML as a result of using LAYOUT_FLOATING
    echo $form->field($model, 'status')->radioList([0 => 'Inactive', 1 => 'Active']);
ActiveForm::end();

What is the expected result?

A normal stacked radio list with label on top https://getbootstrap.com/docs/5.3/forms/checks-radios/#default-stacked

image

What do you get instead?

Stacked radio list but the label is rendered incorrectly inside the list:

image

Additional info

Q A
Yii vesion 2.0.47 (advanced template)
PHP version 8.1.2
Operating system Ubuntu 22.04.1 LTS
yiisoft/yii2-bootstrap5 2.0.4

vip9008 avatar Mar 06 '23 05:03 vip9008