Closed (fixed)
Project:
Field Validation
Version:
7.x-2.6
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Apr 2012 at 16:11 UTC
Updated:
20 Dec 2017 at 16:51 UTC
Jump to comment: Most recent
Comments
Comment #1
g089h515r806 commentedI have only test it with the entity of drupal core, it works.
Comment #2
g089h515r806 commentedI have test field validation with Address field in checkout of commerce module, it works very well.
It works with normal field at order edit form page.
It does not work with embed field form, such as address embed in order, field collection embed in a node,
This is bug.
Comment #3
g089h515r806 commentedThis is bug of part of field validation, I have fixed it in dev version.
But it still does not works. To make it works correctly, Commerce/AddressField module need provide correctly field level validation using hook_field_widget_error.
Field Collection is a good example of such validation
Comment #4
acrazyanimal commentedI think this is the same issue.. if you add an email field to the billing information and type in 'ijsdhfk' for the email, the validation error shows up on the review page. So the error is essentially ignored and the value is accepted into the email field. You are allowed to continue on.
What should happen when the field validation fails as is usual, the user should be redirected back to the form to correct their value. Its interesting that if you make that email field 'required' and leave it blank, then the proper redirection happens back to the form. Also, if you have the account info show up on an anonymous checkout and fill in an improper email value like above, the validation works as it should and you are redirected back to the form properly.
edit: woops, didn't realize this was the field validation issue queue. I had searched commerce and this came up. sorry.
Comment #5
g089h515r806 commentedNow, This is a bug of commerce/addressfield module,
In field validation beta2, we support two methods to set error message, Commerce need to implement hook_field_widget_error correctly and set the parent array correctly.
I have examined the code of addressfield, and find that it does not set the parent array correctly. field collection module did this job very well, it is a good example for other module to follow.
If a the field widget embeded in another big form, we need set the parent array correctly.
Here is an example of parent array:
array(
0 => 'field_myfield',
1=>'und',
2=>'value',
)
to support a form embed in another form, such as field collection module, need to set the parrent array in this way:
array(
0 => 'field_myparentfield',
1=>'und',
2=>'value',
3=>'field_mychildfield',
4=>'und',
5=>'value',
)
How ever, the parrent array in addressfield module is empty.
Commerce module does not check if form_get_error is not empty, there maybe some code :
If(!empty(form_get_error ())){
prevent continue;
}
Field validation set the error message, but commerce could not find the form element which is the target of the error message, then this error message be skipped.
Comment #6
mrfelton commentedAlso see #1348384: validation email field on customer profile doesn't work
Comment #7
mrfelton commentedComment #8
geek-merlinI found this is fixed now IFF validator is condigured to "Set errors using field API".
So closing.
Comment #10
khan2ims commentedI am facing same issue again with latest release 7.x-2.6
Comment #11
tokiSame issue for me with Commerce 1.13 and Field validation 2.6 (Drupal 7.56)
I have tried a simple validation (minimum length 50 characters on long text field) and the checkout process continues without error.
(tests with or without "Set errors using field API")
Comment #12
tokiComment #13
tokiAnother detail about this issue still unsolved, after checkout the field validation I mentioned in #11 is ignored but later if I try to edit the order as an administrator, the field validation is not ignored anymore and I get the error message about my text field (minimum 50 characters long) (so I have to enter details I would like the customer to write!) Thanks in advance for re-opening this issue and suggest a fix.
Comment #14
geek-merlin#11
> tests with or without "Set errors using field API"
So if you experience something different than #8, you might want to open another issue, as only a project owner can reopen.
You might want to provide a good description how to reproduce, as usual, and be prepared to work on it yourself or hire someone, as most volunteer resources go into 8.x these days.