Matteo
Matteo

Reputation: 171

cakephp label in checkbox

i'm trying to get a checkbox with his label

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

in 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 there is no label

where is the problem?

Upvotes: 5

Views: 17636

Answers (2)

laul
laul

Reputation: 57

I using :

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

Upvotes: 0

Chuck Burgess
Chuck Burgess

Reputation: 11574

You should get what you are looking for with the following:

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

Upvotes: 19

Related Questions