Html Cakephp表单助手输入';要放置在div外部的s标签
我在谷歌上搜索过,只找到了完成这项任务的前后答案,但这不符合我的问题。我想将默认标签元素移到div之外Html Cakephp表单助手输入';要放置在div外部的s标签,html,cakephp,Html,Cakephp,我在谷歌上搜索过,只找到了完成这项任务的前后答案,但这不符合我的问题。我想将默认标签元素移到div之外 <?php echo $this->Form->input('name', array( 'before' => $this->Form->label('Subject:'), 'class' => 'form-control', 'div' => 'col-md-9 col-sm-9 col-xs-12')); ?> 输出为 <
<?php echo $this->Form->input('name', array( 'before' => $this->Form->label('Subject:'), 'class' => 'form-control', 'div' => 'col-md-9 col-sm-9 col-xs-12')); ?>
输出为
<div class="col-md-9 col-sm-9 col-xs-12 required">
<label for="StaffSubject:">Subject:</label>
<input name="data[Staff][name]" class="form-control" maxlength="255" type="text" id="StaffName" required="required">
</div>
主题:
但是我想要这个输出
<label for="StaffSubject:">Subject:</label>
<div class="col-md-9 col-sm-9 col-xs-12 required">
<input name="data[Staff][name]" class="form-control" maxlength="255" type="text" id="StaffName" required="required">
</div>
主题:
最好的解决方案是从输入中删除标签,并在输入之前添加标签
<?php echo $this->Form->label('Subject:');
echo $this->Form->input('name', array(
'label' => false,
'class' => 'form-control',
'div' => 'col-md-9 col-sm-9 col-xs-12'
)); ?>
这应该可以:
<?php echo $this->Form->input('name', array(
'label'=>'Subject',
'class' => 'form-control',
'wrapInput' => 'col-md-9 col-sm-9 col-xs-12',
)); ?>