Symfony 2 date input with only year selector

szilagyif picture szilagyif · Nov 7, 2011 · Viewed 12.9k times · Source

Is it possible to make a date input field, with only year selector widget in Symfony 2 FormBuilder, or should I use a simple text type input field?

Answer

jeroen picture jeroen · Jul 15, 2013

You can also use:

'choices' => range(Date('Y') - 4, date('Y'))