Cake PHP 2 custom Form->Label

Viewed 20789

I'm using the Form helper to generate a label:

$this->Form->label('Contact.name', 'Name');

Which generates the following:

<label for="ContactName">Name</label>

Is it possible to generate the following using the helper:

<label for="ContactName"><span class="mandatory">*</span> Name</label>

Whilst I can manually write the html for the above it becomes a little more difficult when I am using the input method where a label is automatically generated.

For example:

$this->Form->input('Contact.forename',array('div' =>false,
                   'label' => array(
                   text'=> 'First Name',class =>'myclass'),
                   'class' => 'input','size' => '25' ,'tabindex' => '1'));

Is this possible in cake or do I have to manually inject the html using javascript when the page loads? Which I would think is rather ugly.

4 Answers
Related