2013-05-20 32 views
0

我有這樣多的複選框:樣式化表單助手多選複選框

<?php echo $this->Form->input('Power', array('type'=>'select', 'multiple' => 'checkbox', 'options' => $poderes, 'label' => false)); ?>

這就是產生這個HTML:

<div class="input select"><input type="hidden" name="data[Power][Power]" value="" id="PowerPower"/> 

<div class="checkbox"><input type="checkbox" name="data[Power][Power][]" value="1" id="PowerPower1" /><label for="PowerPower1">Negociacao</label></div> 
<div class="checkbox"><input type="checkbox" name="data[Power][Power][]" value="2" id="PowerPower2" /><label for="PowerPower2">Comerciais</label></div> 
<div class="checkbox"><input type="checkbox" name="data[Power][Power][]" value="3" id="PowerPower3" /><label for="PowerPower3">Compras</label></div> 
</div> 

我想提出的一個<div class="checkbox">title改變類。我嘗試了很多方法,並沒有工作。

我該怎麼做?

+0

這太難了 –

回答

1

TLDR:

寫手動PHP foreach()

說明:

記住,CakePHP是剛剛PHP,所以看的字段名稱/ IDS ...等它自動 - 當您執行$this->Form->input()時生成 - 只生成一個foreach()循環,以任何您想要的方式寫出您的複選框。瞧!

CakePHP對於很多事情來說都很棒,但是每隔一段時間你需要足夠的定製,你只需要回退到好的PHP。

+0

我會盡快嘗試。謝謝! –