I would like to add a label to my select
form helper however I am not quite sure how to do this in cake v2+.
This is my current code which does not work:
echo $this->Form->select('format_id', $formats, array('label'=>'Format:'));
You can do this:
echo $this->Form->label('Format');
echo $this->Form->select('format_id', $formats, array());
or
echo $this->Form->input('format_id', array('label'=>'Format', 'type'=>'select', 'options'=>$formats));
I found the answer, it is because you need to use Form->input
like so...
echo $this->Form->input('format_id', array('label'=>'Format: ', 'type'=>'select', 'options'=>$formats));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With