Default date in a Form (symfony2)
forms, symfony
Solution
Is this working for date?
$builder
->add('days', 'date', array(
'widget' => 'choice',
'format' => 'dd-MM-yyyy',
'pattern' => '{{ day }}-{{ month }}-{{ year }}',
'years' => range(Date('Y'), 2010),
'label' => 'Inactive participants since',
'input' => 'string',
'data' => '01-01-2001'
));
Problem
I create a form like this with Symfony2: ``` $builder ->add('days', 'date', array( 'widget' => 'choice', 'format' => 'dd-MM-yyyy', 'pattern' => '{{ day }}-{{ month }}-{{ year }}', 'years' => range(Date('Y'), 2010), 'label' => 'Inactive participants since', 'input' => 'string', )); ``` But I want to display a default date, for exemple today, so, when I print de form I see 02 - 05 - 2012 Any idea?