Answer the question
In order to leave comments, you need to log in
How to insert only input without wrapper in yii2 ActiveForm field?
yii2:
<?php $form = ActiveForm::begin(['enableClientScript' => false,]); ?>
<?= $form->field($model, 'name', ['template' => '{input}']) ?>
<?= $form->field($model, 'email', ['template' => '{input}']) ?>
<?= Html::submitButton('Отправить') ?>
<?php ActiveForm::end(); ?>
<div class="form-group field-testform-name required">
<input type="text" id="testform-name" class="form-control" name="TestForm[name]" aria-required="true">
</div>
Answer the question
In order to leave comments, you need to log in
Set up fieldConfig for the whole form, then you can remove the div with class form-control
<?php $form = ActiveForm::begin([
'fieldConfig' => [
'options' => [
'tag' => false,
]
]
]); ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question