logo
Ask your Symfony questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$5
I still can not get years to appear in date widget

I thought I had this fixed, but I guess not.

See my previous question.

Symfony 1.4 and Doctrine.

In the database I have fields/dates like this:

date_received: 1994-04-06


When I previously asked about this, it was suggested that I needed to have more years appear in the date/year field, so I have this in the form class:

                                    
$years = range(date('Y') - 50, date('Y') + 5);
$this->widgetSchema['date_received'] = new sfWidgetFormDate(array(
'default' => time(),
'years' => $years
));


This causes the year select box to list every year back to 1961.

And yet, check out the attached screenshot. The year still fails to appear. What else might be wrong?



[UPDATE]

Strange. I hit the save button on the form, and now the date in the database is:

0033-04-06

This question has been answered.

attachment image asker uploaded image

Lawrence Krubner | 03/14/11 at 1:34pm Edit

Previous versions of this question: 03/14/11 at 2:00pm

(1) Responses

See a threaded view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    03/14/11
    2:02pm
    José Nahuel Cuesta Luengo says:

    The problem is that $years should be an associative array. Try:


    $years = range(date('Y') - 50, date('Y') + 5);
    $years = array_combine($years, $years);

This question has expired.





Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.