2015-12-22 40 views
0

通常情況下,這個代碼<?= $form->field($model, 'q_36a')->checkbox() ?>將產生如下...如何修改活動表格場yii2

<div class="form-group field-tblquestion-q_36a required"> 

<input type="hidden" name="TblQuestion[q_36a]" value="0"><label><input type="checkbox" id="tblquestion-q_36a" name="TblQuestion[q_36a]" value="1"> Q 36a</label> 

<div class="help-block"></div> 
</div> 

如何修改它,使其這個樣子?

<label> 
     <input name="switch-field-1" class="ace ace-switch ace-switch-5" type="checkbox"> 
     <span class="lbl"></span> 
</label> 

我想這樣做,因爲我在我的應用程序中集成了ace管理模板。

回答

-1

得到它的工作。

<?= $form->field($model, 'q_36a', ['template' => "{input}<span class='lbl'></span>",])->checkbox(['class' => 'ace ace-switch ace-switch-5'], false) ?>