Cakephp label in checkbox

I am trying to check the box with its label

echo $this->Form->checkbox('straordinari', array('div'=>'true', 'label' => 'Straordinari'));

in the browser i get

<input id="ReportStraordinari_" type="hidden" value="0" name="data[Report][straordinari]">
<input id="ReportStraordinari" type="checkbox" value="1" label="Straordinari" div="true" name="data[Report][straordinari]">

but no label

where is the problem?

+3
source share
2 answers

You should get what you are looking for as follows:

echo $this->Form->input('straordinari', array('type' => 'checkbox'));
+19
source

I use:

<?php 
echo $this->Form->input('coupDeCoeur', 
array('div' => false,
'label' => false,
'type' => 'checkbox',
'before' => '<label class="checkbox">',
'after' => '<i></i>coupDeCoeur</label>'
));
?>
0
source

All Articles