When the user enters an invalid email, the error message displayed is 'email_invalid' instead of the translated error message.

The reason for that is that the module does not implement hook_field_widget_error().
The default validation mechanism then uses the variable $error['error'] instead of $error['message'] as the error to be displayed. Therefore, even though the proper $error['message'] is defined in email_field_validate(), it is bypassed and the error code 'email_invalid' is displayed.

CommentFileSizeAuthor
#3 email-1048540-1.patch440 bytesjsenich
email-validation-error.patch334 bytesNarthorn

Comments

DavidHadaller’s picture

Status: Needs review » Reviewed & tested by the community

I had the same issue, applied this patch to email-7.x-1.0-beta1, and the error message is correctly displayed. Implementing hook_field_widget_error, as Narthorn does, is the correct solution to this issue in my opinion; I have solved it the same way in custom fields I've created.

jsenich’s picture

StatusFileSize
new440 bytes

This worked for me. Here's the patch against 7.x-1.x-dev.

hnln’s picture

sub and patch seems to work

afeijo’s picture

the patch works, thanks

is this module abandoned? if the author needs a hand to patch, test and commit, I can jump in

bocaj’s picture

I can confirm as well that this patch fixes the bug. Would love to see this committed!

Andrew Schulman’s picture

Confirmed here as well.

mh86’s picture

Status: Reviewed & tested by the community » Fixed

Committed patch from #3. Thanks for the patch and the reviews!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.