I added a "Birth date" field to the user entity. It uses the "Pop-up calendar" widget and has Starting year set to -100 and Ending year set to -14.

The popup correctly shows a drop-down list with years ranging from 1912 to 1998 but nothing prevents the user from manually typing and saving a date such as "08/05/2012".

I think the date_popup module should verify the year range? I've attached a patch which works for me but I'm not sure if it's the best solution.

CommentFileSizeAuthor
date_popup_validate_date_range.patch533 bytesjoericapens
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Paul B’s picture

If the date is outside the range, the date/time is not converted to a string (done in date_popup_validate I believe).
If you have a form validation function that checks the date, it will suddenly see an array instead of a string for the date.

Paul B’s picture

Version: 7.x-2.5 » 7.x-2.x-dev
Category: Bug report » Feature request
Issue summary: View changes

Also, this only adds validation to the date_popup, not to the date_text. I think both widgets should have validation, so both should have a year range setting.

Paul B’s picture

Status: Active » Closed (duplicate)