Address Field defines a new field type to store international postal addresses, implementing a subset of the top-level address elements defined in the xNAL standard (see the glossary below).
The field configuration lets you determine which elements of an address should be present in the field widget form and which ones should be rendered for display.
This module was initially developed to support address storage in Drupal Commerce customer profiles, but it is now used by a wider variety of modules dealing with physical addresses and mapping.
- Standardized storage of international postal addresses based on the xNAL standard (the same format used by Google Maps for geocoding)
- Per-country edit form and formatting of addresses
- Proper formatting of address forms and output on a country by country basis as they are added to the module; see the address formats issue queue for pending country support
- Feeds integration for address importing
This module does not store or manipulate geographic coordinates or integrate with GIS systems, but it works well in conjunction with modules that do, like Geocoder. It currently does not provide vCard / hCard output, but the issue queue contains open issues for pursuing such support.
Address Field should work on any entity type, but if you use it on an entity type that can be created or edited by anonymous users (such as a user account field present on the registration form), you should ensure pages where the form is present are not cached by Drupal. Drupal's core page caching and its AJAX form refresh used by this module do not work together.
The recommended solution for now is to use the Cache Exclude module to tell Drupal which pages not to cache, such as user/register.
Tokens for address field components and additional helper tokens (such as a token for the country name vs. the country code) are available if you are using the Token module. For more information, see the recent issue resolution related to token support.
The Field Validation module supports validating address field postal codes on a per-country basis using the Postal Code Validation module. Other levels of address validation likely require integration with third party web services (e.g. FedEx Address Validation).
As mentioned, this module uses the xNAL (Extensible Name and Address Language) vocabulary for describing address information. The terms used to designate various parts of an address may not be immediately recognizable, so this quick glossary equates the address parts in xNAL to their equivalent U.S. address terms (with some being self-evident):
- country => Country (always required, 2 character ISO code)
- name_line => Full name (default name entry)
- first_name => First name
- last_name => Last name
- organisation_name => Company
- administrative_area => State / Province / Region (ISO code when available)
- sub_administrative_area => County / District (unused)
- locality => City / Town
- dependent_locality => Dependent locality (unused)
- postal_code => Postal code / ZIP Code
- thoroughfare => Street address
- premise => Apartment, Suite, Box number, etc.
- sub_premise => Sub premise (unused)