I'm using the Date API to show a date field with Month/Day/Year and it is "required" (with no default). If I don't enter anything, the error message appears as follows:

• Month field is required.
• Day field is required.
• Year field is required.
• Field Birthday has errors. The year must be a number between 1 and 4000. The month must be a number between 1 and 12. The day must be a number between 1 and 31.

The "required" messages have already stated what is wrong. The "Field birthday has errors..." message is not needed in this case, and IMHO it just adds confusion to the issue.

The value error check should distinguish between blank (or null) values vs. values that were entered outside the accepted ranges, and show the error message only in the latter case.

Comments

I too found it redundant and used string overrides on each of the four individual t strings to craft a custom message relating to the birthday field on my registration form. Here are the t strings from date_api_elements.inc in case someone else wants to do this workaround. (Each line below is a separate t string, so it needs its own individual override).

Field %field has errors.
The year must be a number between %min and %max.
The month must be a number between 1 and 12.
The day must be a number between !min and !max.

Is there any way to hide these 3 messages completely? I tried disable message module but it couldn't hide them.

if you put the above lines individually into string overrides and then leave each replacement field blank, i believe they won't appear...it's been a while since i first did it but it worked then

@j0e Yes, it works. Thanks a lot!

great, you're welcome

Duplicate of #1005182: Required date error message(s) which has a slightly nicer solution, removing the three unnecessary (day, month, year) messages.