Closed (fixed)
Project:
Field Validation
Version:
7.x-1.0-beta4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Oct 2011 at 21:40 UTC
Updated:
27 Feb 2012 at 12:20 UTC
Jump to comment: Most recent
Comments
Comment #1
g089h515r806 commentedHow to reproduce your case.
I have test it on my site, it works correktly.
Could you add other validator and test the error message?
make sure this is a bug only in "oneofseveral" validator or in multiple validators.
Comment #2
hgurol commentedI guess its a conflict with the Phone Module, http://drupal.org/project/phone
When my field type is Phone Number and the widget is Text Field, the problem is there with all validators.
When my field type is Text and the widget is Text Field, it works.
Phone Module has its own validation and own error message. I believe that's where the conflict is.
How we can solve this problem?
Thanks...
Comment #3
g089h515r806 commentedI have checked the code of phone module. there maybe a bug in phone module:
the code should be(i think):
'message' key was missing in phone module.
Comment #4
hgurol commentedI dont think that 'message' key is the problem but anyhow, I asked the Phone module maintainer to take a look at the issue.
Thank you...
Comment #5
sammyd56 commentedI'm having the same problem with Link module.
I've submitted an issue there #1347600: Incompatibility with Field Validation module, but given that there is a similar problem with the Phone module, perhaps the problem lies in the Field Validation module's code...
Comment #6
hgurol commentedI haven't heard from the Phone module maintainer about this issue #1317010: Conflict with Field validation Module.
Maybe the conflict is with all the modules which has its own validation?
Comment #7
g089h515r806 commentedI test it, it is an error.
the reason maybe come from "hook_field_process", i am not sure.
The module which has "hook_field_process" may conflict with Field validation.
Comment #8
g089h515r806 commentedThis is a bug, i am not sure it is derived from field validation, or Drupal Core.
It does not work very well with compound field,such as link, image,addressfeld,phone.
For single field, the error message come from "message" key, this key is required for single field.
For compound field, the error message come from "error" key, "message" key is omitted.
I find a quick solution:
make the 'error' and 'message' the same.
Comment #9
g089h515r806 commentedTest with the dev version, I have fixed.
I only test the code with Unique validator.
Comment #10
b-prod commentedI think the problem comes from Field core module, in the function
field_default_form_errors()(field.form.inc file). The following code is used for widgets that do not implement[widget]_field_widget_error()function:form_error($error_element, $error['error']);On the Drupal API for such function (http://api.drupal.org/api/drupal/modules!field!field.api.php/function/ho...), the given example uses
form_error($element['value'], $error['message']);.So there is a conflict there, that will probably take a lot of time to be fixed. So I agree that the quick fix in #8 is a good workaround for this issue.
Moreover, in the
FieldValidationExceptionclass, the errors array is clearly defined as:Comment #11
b-prod commentedHere is a patch against Drupal core to correct this issue without hacking the code of Field Validation, which is the correct and expected one.
#1432732: Form error reporting fallback does not respect Drupal documentation (first comment)
@g089h515r806: Actually, I am not so sure that putting the error message in the 'error' key is a good idea, since it breaks with the expected behavior and documentation. It could be better to suggest a patch file awaiting this issue is fixed in Drupal core, but keep the Field Validation module code clean.
Comment #12
g089h515r806 commented$errors array of Drupal core does not support a field with several form elements.
It work for a field only have one form element.
Comment #13
g089h515r806 commentedtest the latest dev code which fix this issue.
Comment #14
Anonymous (not verified) commentedI had this issue with regex-validation of a link field.
It's fixed in the dev code. Great work, g089h515r806!
Comment #15
g089h515r806 commented