Reputation: 1
i was trying like this <?php echo $form->label('full_name', 'Full name', array('wrap'=>'span','class' => 'required'));?>
Expected output:
<label for="full_name">
Full name
<span class="required"> </span>
</label>
Upvotes: 0
Views: 3731
Reputation: 41
you can do like this :
<?php
echo $this->Form->label('short_link', 'Custom URL <span style="font-size:9px;"><em>(Optional)</em></span>:', array('class' => 'YOUR CLASS FOR LABEL'));
echo $this->Form->input('short_link',array('label'=>false,'class'=>'YOUR CLASS FOR INPUT','value'=>'','size'=>'40'));
?>
Upvotes: 1
Reputation: 4517
you can even simplify it a bit more by putting it inside your input element :
<?php echo $this->Form->input('full_name', array('label'=>'<span>Full Name</span>', 'class'=>'required')); ?>
Upvotes: 0
Reputation: 1387
<?php echo $form->label('full_name', 'Full name <span class="required"> </span>', array());?>
Not sure if there's a cake way of wrapping the text inside the label in an element. But the above will give you the expected result.
Upvotes: 1