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

Bootstrap : display label in inline form

Open yii-bot opened this issue 9 years ago • 3 comments

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 ?

yii-bot avatar Jan 24 '16 14:01 yii-bot

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 avatar Jan 24 '16 14:01 cebe

@cebe Is that implemented? If not, is there any existing solution to do that?

bologer avatar Jun 13 '17 08:06 bologer

@bologer what exactly? there is no option to enable it yet, you have to use the code I gave above for now.

cebe avatar Jun 13 '17 15:06 cebe