Question

I am developing an application using Symfony2. The problem comes when creating a registration form that require to use a date field to indicate the date in which the user was born, the possible values for the year are in range 2007-2017. How can I modify this values the years to be for example,in the range 1920-actual year? Thanks.

Was it helpful?

Solution

Look up in the documentation next time:

$builder->add('birthday', 'date', array(
    'years' => range(1920, date('Y'))
));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top