Examples: Inline Layout

If layout is set to inline an inline form is rendered.

<?php $form = ActiveForm::begin(['layout' => 'inline']) ?>

Following is a list of the most common form elements to exemplify different options and validation states.

Note: While the class does support error messages and hints in this mode, Bootstrap 3 does not really display them nicely. That's why error messages are disabled by default in this mode. You can enable them at your own risk through enableErrorBlock in the fieldConfig on the form. Also note that input groups are not really supported well by Bootstrap 3, as they span the full width.


Default Options

<?php $form = ActiveForm::begin() ?>
    <?= $form->field($model, 'demo'); ?>
    <?= $form->field($model, 'demo')->checkbox(); ?>
    <?= $form->field($model, 'demo')->dropDownList($items); ?>
    <?= $form->field($model, 'demo')->checkboxList($items); ?>
<?php ActiveForm::end(); ?>

Hint

Hint text

Hint text

Hint text

<?php $form = ActiveForm::begin() ?>
    <?= $form->field($model, 'demo')->hint('Hint text'); ?>
    <?= $form->field($model, 'demo')->hint('Hint text')->checkbox(); ?>
    <?= $form->field($model, 'demo')->hint('Hint text')->dropDownList($items); ?>
<?php ActiveForm::end(); ?>