Reputation: 89
I am wondering if there is a way to specify the date format in the forms created using CakePHP's $form->inputs(); Please note that this is not the individual $form->input() but instead $form->inputs() that will create the whole form fields automagically.
Any input will be appreciated. Thanks.
Upvotes: 3
Views: 6415
Reputation: 11212
You can pass the usual options into $form->inputs
that you would pass into $form->input
.
For example, if you want to customise field2
below, you make the field name the key and the options array the value:
echo $form->inputs(array(
'field1',
'field2' => array(
'label' => 'Date and time',
'type' => 'datetime',
'dateFormat' => 'DMY',
'minYear' => date('Y') - 1,
'maxYear' => date('Y'),
'empty' => true,
),
'field3',
));
Upvotes: 7