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

Custom radio|checkbox inline error

Open DrDeath72 opened this issue 6 years ago • 5 comments
trafficstars

What steps will reproduce the problem?

render inline custom radiolist

What's expected?

on client validate error under list

What do you get instead?

error after last radio inside it

Additional info

Q A
Yii vesion
PHP version
Operating system

DrDeath72 avatar Aug 28 '19 10:08 DrDeath72

Снимок экрана от 2019-08-28 15-19-35

DrDeath72 avatar Aug 28 '19 10:08 DrDeath72

Would you please post some code?

samdark avatar Aug 28 '19 10:08 samdark

<?php
$model = new yii\base\DynamicModel([
	'test'
]);
$model->addRule('test', 'required');
$form = yii\bootstrap4\ActiveForm::begin();
echo $form->field($model, 'test', [
	'inline' => true,
])->radioList([
	'' => 'Buggy',
	1 => 'Y',
	0 => 'N',
]);
echo \yii\bootstrap4\Html::submitButton();
yii\bootstrap4\ActiveForm::end();

DrDeath72 avatar Aug 28 '19 10:08 DrDeath72

also add bs4 ActiveField to return for hints like ->inline()

<?php
class ActiveForm extends \yii\widgets\ActiveForm
    /**
     * {@inheritdoc}
     * @return \yii\widgets\ActiveField|ActiveField
     */
    public function field($model, $attribute, $options = [])
    {
        return parent::field($model, $attribute, $options);
    }
}

DrDeath72 avatar Aug 28 '19 11:08 DrDeath72

This is confirmed. The problem is that the error message gets appended inside the last radio element, and the layout flows it to its right.

Screen Shot 2020-06-29 at 6 03 24 PM

Bootstrap 4 doesn't document inline radios & checkboxes case, so I guess it's not really supported. Could be fixed by changing the generated markup and rolling some additional CSS..

machour avatar Jun 29 '20 17:06 machour