Problem/Motivation

When validating a field value, phone_field_validate does not properly reports the error. On the UI, the error are not displayed to the user. The following PHP Notice is displayed if error reporting is not disabled:

Notice : Undefined index: message dans field_default_form_errors() (ligne 382 dans /Users/buyle/Documents/svn/leucan/drupal/dist/modules/field/field.form.inc).

The array appended to code>$errors[$field['field_name']][$langcode][$delta] in phone_field_validate does not include a messageitem (see documentation for hook_field_validate).

Proposed resolution

In phone_field_validate, append an array with the message and error properties to $errors[$field['field_name']][$langcode][$delta].

CommentFileSizeAuthor
#1 report_validation_errors-1783770-1.patch922 bytespbuyle

Comments

pbuyle’s picture

Status: Active » Needs review
StatusFileSize
new922 bytes

The attached patch fixes the issue.

johannez’s picture

I had the same issue in Drupal 7.15. Looks like the was a change in the field API (hook_field_validate). This patch worked fine for me. Thank you, Pierre!

Please implement this fix asap as probably other people will run into this and it's the major feature of this module :)

Cheers,
Johannes

rowbotony’s picture

Thank you for the patch! I'm using this with Drupal commerce, and a valid phone number is kind of a big deal. Thanks!

philsward’s picture

I also confirm the patch to work. Thx for posting it : )

pbuyle’s picture

Status: Needs review » Reviewed & tested by the community

I guess 3 positives feedback comments on a trivial 2 lines patch makes it "reviewed and tested by the community" :)

slcp’s picture

slcp’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

Closed as per previous comment. This leaves #1715380: Notice: Undefined index: message in field_default_form_errors() (line 381 of /var/www/drupal/modules/field/field.form.inc). for any further activity.

Awaiting someone with commit access to get something rolled into dev.

slcp’s picture

Issue summary: View changes

Update error description