Reputation: 9800
I'm using form helper to input date select as follows
echo $this->Form->date('date_from', [
'empty' => [
'year' => 'Choose Year',
'month' => 'Choose Month',
'day' => 'Choose Date'
],
'label' => 'Date From'
]);
But this is only showing select field and not the label Date From
Upvotes: 0
Views: 476
Reputation: 1
You can add the label in your HTML code:
<div class="input date">
<label>My label</label>
<?php echo $this->Form->date('from_date'); ?>
</div>
The difference between the Date Form Control and Form Control is that the last one outputs the div
wrapper and the label
(among others).
Upvotes: 0
Reputation: 2195
It looks like CakePHP3 form helper with date
doesn't support label
as parameter.
But this will generate exactly the same label as you want:
<?php
echo $this->Form->label('Date From');
echo $this->Form->date('date_from', [
'empty' => [
'year' => 'Choose Year',
'month' => 'Choose Month',
'day' => 'Choose Date'
],
]);
?>
See here: Creating label in CakePHP3 form helper.
Upvotes: 0