I have problem with displaying required fields in Cakephp 2.4.2.
If I use
$this->Form->input('username');
in rendered html I have
<div class="input text required">
<label for="UserUsername">Username</label>
<input name="data[User][username]" type="text" id="UserUsername" required="required"/>
</div>
and the label has asterisk: username*
If I want to use Twitter Bootstrap with its horizontal form style, my input changes to something like this:
<div class="form-horizontal">
<div class="form-group">
<label for="username" class="col-xs-3"></label>
<div class="col-xs-4">
<?php echo $form->input('username',array('id' => 'username','label' => false)); ?>
</div>
</div>
</div>
which results in
<div class="form-horizontal">
<div class="form-group">
<label for="username" class="col-xs-3">Username</label>
<div class="col-xs-4">
<div class="input text required">
<input name="data[User][username]" id="username" type="text" required="required"/>
</div>
</div>
</div>
</div>
and label lost asterisk: username
Basically, if Cake input has option 'label' => false it will have input label without asterisk:
$this->Form->label('User.username');
$this->Form->input('username',array('label' => false));
results in
<label for="UserUsername">Username</label>
<div class="input text required">
<input name="data[User][username]" type="text" id="UserUsername" required="required"/>
</div>
and no asterisk in the label.
What would be the way to have asterisk in the label of the required field while using Cake Form Helper?