Reputation: 111
I need to this HTML
<div class="input-group form-control">
<input type="text" placeholder="От">
<span>-</span>
<input type="text" placeholder="До">
</div>
But my yii2 code do this HTML
<div class="input-group form-control">
<div class="form-group field-clientsobjecttype-0-price_from">
<input type="text" placeholder="От" name="ClientsObjectType[0][price_to]">
</div>
<span>-</span>
<div class="form-group field-clientsobjecttype-0-price_to">
<input type="text" placeholder="До" name="ClientsObjectType[0][price_to]">
</div>
</div>
How to remove this wrapper - <div class="form-group field-clientsobjecttype-0-price_from">
??
This is my view
<div class="input-group form-control">
<?= $form->field($objects, "[{$i}]price_from", ['template' =>'<input type="text" placeholder="От" name="ClientsObjectType[0][price_to]">'])->textInput([])->label(false); ?>
<span>-</span>
<?= $form->field($objects, "[{$i}]price_to", ['template' =>'<input type="text" placeholder="До" name="ClientsObjectType[0][price_to]">'])->textInput([])->label(false); ?>
</div>
So, how I can fix this problem ??
Upvotes: 1
Views: 4126
Reputation: 1
Try $form->field($objects, "[{$i}]price_from", ['options' => ['class' => 'custom-class']])
or
Try $form->field($objects, "[{$i}]price_from", ['options' => ['tag' => false]])
Upvotes: 0
Reputation: 1160
Try $form->field($objects, "[{$i}]price_from", ['options' => ['tag' => false]])
Upvotes: 8