uc_shipping.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * @file
  3. * Adds autofill address functionality to shipment forms.
  4. */
  5. /**
  6. * Autofills shipment address form from user selection.
  7. *
  8. * @param type
  9. * Field prefix used to identify the address.
  10. * @param json_address
  11. * JSON object of address data.
  12. */
  13. function apply_address(type, json_address) {
  14. //if (json_address != "0") {
  15. eval("var address = " + json_address +";");
  16. jQuery('#edit-' + type + '-first-name').val(address.first_name);
  17. jQuery('#edit-' + type + '-last-name').val(address.last_name);
  18. jQuery('#edit-' + type + '-phone').val(address.phone);
  19. jQuery('#edit-' + type + '-company').val(address.company);
  20. jQuery('#edit-' + type + '-street1').val(address.street1);
  21. jQuery('#edit-' + type + '-street2').val(address.street2);
  22. jQuery('#edit-' + type + '-city').val(address.city);
  23. jQuery('#edit-' + type + '-postal-code').val(address.postal_code);
  24. if (jQuery('#edit-' + type + '-country').val() != address.country) {
  25. jQuery('#edit-' + type + '-country').val(address.country);
  26. }
  27. jQuery('#edit-' + type + '-zone').val(address.zone);
  28. //}
  29. }