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

g089h515r806’s picture

update to latest commerce module, it is fixed in commerce.

mbasfour’s picture

Do you mean the latest dev version of commerce module? because i already have the latest stable version installed.

GroggySylv’s picture

I experience the same problem with the last drupal commerce module version.
Any solution ?

g089h515r806’s picture

Similar 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()) {

g089h515r806’s picture

Issue summary: View changes

Changed too to to