yii2-bootstrap
yii2-bootstrap copied to clipboard
Bootstrap : display label in inline form
This issue has originally been reported by @klevron at https://github.com/yiisoft/yii2/issues/10103. Moved here by @cebe.
Actually if I want to display a label in an inline form, I have to do this :
<?php $form = ActiveForm::begin(['layout' => 'inline']); ?>
<?= $form->field($model, 'field')->label(null, ['class' => '']) ?>
<?php ActiveForm::end(); ?>
https://github.com/yiisoft/yii2-bootstrap/blob/2.0.5/ActiveField.php#L379
There should be a proper way to do this (same for enableError
), no ?
To enable this for all labels I use it this way:
<?php $form = ActiveForm::begin([
'layout' => 'inline',
'fieldConfig' => [
'labelOptions' => ['class' => ''],
'enableError' => true,
]
]); ?>
could be added as an option though.
@cebe Is that implemented? If not, is there any existing solution to do that?
@bologer what exactly? there is no option to enable it yet, you have to use the code I gave above for now.