所以我有这个表格来添加一个报告,我的报告有很多措施。我的问题是,我想将度量的显示“拆分”成组(度量属于一个组)。
我有这个:
//Controller/Report/add
$measures = $this->Report->Measure->find('list');
还有这个:
//View/Report/add.ctp
echo $this->Form->input('Measure', array('label' => false, 'multiple' => 'checkbox'));
这输出:
<div class="input select">
<input type="hidden" name="data[Measure][Measure]" value="" id="MeasureMeasure"/>
<div class="checkbox">
<input type="checkbox" name="data[Measure][Measure][]" value="1" id="MeasureMeasure1" />
<label for="MeasureMeasure1">
...
</label>
</div>
....
</div>
但是我需要类似的东西:
<h2>Measure Group 1</h2>
<div class="input select">
<input type="hidden" name="data[Measure][Measure]" value="" id="MeasureMeasure"/>
<div class="checkbox">
<input type="checkbox" name="data[Measure][Measure][]" value="1" id="MeasureMeasure1" />
<label for="MeasureMeasure1">
...
</label>
</div>
....
</div>
<h2>Measure Group 2</h2>
<div class="input select">
<input type="hidden" name="data[Measure][Measure]" value="" id="MeasureMeasure"/>
<div class="checkbox">
<input type="checkbox" name="data[Measure][Measure][]" value="1" id="MeasureMeasure1" />
<label for="MeasureMeasure1">
...
</label>
</div>
....
</div>
实现这一目标的最佳方法是什么?