如何删除<div form-group =“”> yii2

时间:2016-11-17 22:28:59

标签: html yii2

我需要这个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>

那么,我如何解决这个问题?

1 个答案:

答案 0 :(得分:3)

尝试$form->field($objects, "[{$i}]price_from", ['options' => ['tag' => false]])