Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When you choose a address, it work great, but if after that, the user select the #empty_value ( the "- choose an address -" option), it thow an ajax error.
I was trying to debug this in order to don't make the ajax callback when the #empty_value is selected, but I couldn't
Here I attach a screenshot
regards.
Comment | File | Size | Author |
---|---|---|---|
Captura de pantalla de 2013-01-21 10:42:51.png | 153.78 KB | akalam |
Comments
Comment #1
akalam CreditAttribution: akalam commentedI don't know if it is usefull but the error message is thrown in misc/ajax.js line 451:
since commenting this line stop throwing the alert
Comment #2
jsacksick CreditAttribution: jsacksick commentedI just tried to do that and I couldn't reproduce the issue.
Comment #3
sin CreditAttribution: sin commentedThe same for me in rc7, trying to debug now.
EDIT
AJAX Error is:
EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. function EntityDrupalWrapper->set() (string 744 in /sites/all/modules/entity/includes/entity.wrapper.inc).
EDIT
commerce_addressbook.module:452
$order_wrapper->{$field_name} = NULL;
this causes exception for me in entity.wrapper.inc set() due to failed $this->validate($value) check.
Comment #4
sin CreditAttribution: sin commentedI found the problem source.
The validation code in entity/includes/entity.wrapper.inc:151 causes an exeption if customer billing profile order field is marked as required at admin/commerce/config/order/fields/commerce_customer_billing.
This field is not required in Commerce Kickstart and not required in Drupal Commerce default installation. Checkout fields validation works just fine without it.
So the solution is not to mark order profile field as required :) Maybe it would be better to just disable required option. Not a Commerce Addressbook problem I think.
Comment #5
mibfire CreditAttribution: mibfire commentedThis caused my a huge debug time too. Maybe address module should check these required setting for shipping and billing fields and throw a message about that the reuired setting should be disabled.
The solution would be if commerce and shipping module removed this required settings and set these to disabled by default(in this case addressbook module shouldnt do any check).
Comment #6
wangxb07 CreditAttribution: wangxb07 commentedcommerce_addressbook.module:452
$order_wrapper->{$field_name} = NULL;
The target field not allow be settings to NULL type.
change NULL to -1.