4

My target is to create a custom Date field (which should work with Doctrine). The main difference with the basic Symfony's one is that it shouldn't be 3 dropdowns, but one <input type="date">.

I've tried several tutorials like Symfony's book and some helpful answers here.

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

Could anybody write or advise the tutorial for this task?

Thanks in advance.

2 Answers 2

6

The date field type supports that already. Just set the widget option to single_text and voila — you'll have what you want. No need to create a special type for that. :)

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for an answer! However it renders '<input type="text">' while i still want it to be 'type="date"'
Figured it out wit the help of symfony.com/doc/current/cookbook/form/…
0

In Symfony >= 2.6 they introduced a html5 option which will generate a HTML5 input element.

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.