Creating a date field in Symfony2 format (HTML5)

My goal is to create a custom date field (which should work with Doctrine). The main difference from the basic Symfony is that it should not be 3 drop-down menus, but one <input type="date"> .

I tried several guides like the Symfony book and some useful answers here.

However, the more solutions I try to implement, the more problems I see.

Can someone write or advise a tutorial for this task?

Thanks in advance.

+4
source share
2 answers

The type of date field that is already supported. Just set the widget parameter to single_text and voila - you will have what you want. No need to create a special type for this. :)

+6
source

In Symfony> = 2.6, they introduced the html5 parameter, which will generate the HTML5 input element.

You can see the documentation here: http://symfony.com/doc/current/reference/forms/types/date.html#html5

0
source

Source: https://habr.com/ru/post/1403363/


All Articles