Reputation: 65
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<?php ActiveForm::end(); ?>
How can I get the input text box without bootstrap 3 wrapper codes ?
I am using a custom HTML wrapper and how can I implement my own template for the text box ?
thanks
Upvotes: 2
Views: 565
Reputation: 7093
Depends whether you want to change div's class or input itself.
<?= $form->field($model, 'title', ['options' => ['class' => 'custom_class_div']])->textInput(['class' => 'custom_class_input']) ?>
I have given two options
with overwriting classes from bootstrap.
custom_class_div
will replace boostrap for div (input's parent). custom_class_input
will replace boostrap for input. Basically, it removes form_group
in both cases but in first option it will remove that part where input field takes entire "line" in parent div and in second option this will modify input itself (will still be just 1 input on the "line" but no border shadows, smaller input field, etc.).
If you don't have any classes but just want to use style in div/input element, you can replace class
with style
, for example:
<?= $form->field($model, 'title')->textInput(['style' => 'width: 150px']) ?>
Upvotes: 3