Active
Project:
Field Validation
Version:
7.x-2.2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Dec 2012 at 23:11 UTC
Updated:
11 Jan 2013 at 08:06 UTC
Hi
I installed commerce kickstart and then i added the field validation module and use it to add a php validation to a field added to The customer billing information profile but it's not working correctly because it didn't prevent the form from submitting it's data
My validation is very simple i want to make a field required only when the user enter a value in another field and for this purpose I'm using this code:
if ((!empty($this->entity->field_authorized_person['und'][0]['value']) && empty($this->entity->field_authorized_person_id_numbe['und'][0]['value'])) ||
(empty($this->entity->field_authorized_person['und'][0]['value']) && !empty($this->entity->field_authorized_person_id_numbe['und'][0]['value'])) ) {
$this->set_error();
}
So is there any way to get this code to work?
Comments
Comment #1
g089h515r806 commentedupdate to latest commerce module, it is fixed in commerce.
Comment #2
mbasfour commentedDo you mean the latest dev version of commerce module? because i already have the latest stable version installed.
Comment #3
GroggySylv commentedI experience the same problem with the last drupal commerce module version.
Any solution ?
Comment #4
g089h515r806 commentedSimilar issues:
1, http://drupal.org/node/1541810
2,http://drupal.org/node/1348384, mrfelton fix a similar issue on customer profile.
Commerce need to add following code to prevent form submit.
if ($form_state['submitted'] && !form_get_errors()) {Comment #4.0
g089h515r806 commentedChanged too to to