2

I am comparatively new to CakePHP3. I am creating a form with a Date of Birth field in it, with dob field name.

echo $this->Form->input('dob',['label'=>'Date of Birth']);

Fields are rendered in Year - Month - Day sequence. I want it be rendered in Day - Month - Year sequence. I have been checking the CakePHP3 documentation for sometime now but I am not able to change the order of the date fields. Here is how it is rendered:

enter image description here

Please guide me. Thanks in Advance.

Arvind K.
  • 1,184
  • 2
  • 13
  • 27

1 Answers1

2

Oh I found it here, in the FormHelper API documentation! There is dateWidget template in 'templates' which one can use to change the default sequence of date fields. For example I had to do like this:

echo $this->Form->input('dob',['label'=>'Date of Birth', 'templates' => ['dateWidget' => '{{day}}{{month}}{{year}}']]);
Arvind K.
  • 1,184
  • 2
  • 13
  • 27