我需要这个HTML
<div class="input-group form-control">
<input type="text" placeholder="От">
<span>-</span>
<input type="text" placeholder="До">
</div>
但我的yii2代码执行此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>
如何删除此包装器 - <div class="form-group field-clientsobjecttype-0-price_from">
??
这是我的观点
<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>
那么,我如何解决这个问题?
答案 0 :(得分:3)
尝试$form->field($objects, "[{$i}]price_from", ['options' => ['tag' => false]])