Skip to main content

Use Address and Phone fields

Audience: content managers, administrators.
Time: 10 minutes.
New in 5.5: the address field uses the Google Places widget, and the Phone field lists all countries when no limit is configured.

1. Configure the International Address field (addressint)​

API keys​

The field can use Google Maps or Nominatim. In the field configuration:

SettingUse
Map API for editing (mapapi_edit)googlemap or nominatim
Google Maps JavaScript API key (google_maps_js_api_key)Edit form: enable Maps JavaScript API and Places API (New)
Nominatim tile/API URLUsed with nominatim
Map API for display (mapapi)googlemap or openstreetmap
Google Maps Static API key (google_maps_static_api_key)Map display on the site
caution

Two distinct keys are needed: one for editing (Places) and one for display (Maps Static).

Autocomplete​

Settings ac_types_default and ac_type_allowed_list define proposed address types: All, geocode, address, establishment, (regions), (cities). ac_country_default and ac_country_allowed_list limit countries.

In 5.5, the form uses the Google Places widget (PlaceAutocompleteElement): start typing an address, select a suggestion, then fields are filled automatically (address, city, province, postal code, country, latitude/longitude, URL). Changing the autocomplete type in the form reloads the corresponding suggestions.

If the proposed country is not allowed, a COUNTRY_NOT_ALLOWED_WARNING / PLEASE_USE_COUNTRIES warning is displayed and the value is refused. If Google cannot find the address: “Google could not look up this address. Try again or enter the address manually.”

note

Google limits restriction to 15 country codes: beyond that, the list passed to the widget is emptied and final validation is done server-side.

Map and marker​

  • Edit latitude/longitude (edit_latlon): No, Readonly or Yes.
  • Moving a marker on the map updates coordinates; with the default tolerance of 50 meters, the nearest address is found. Beyond that, only coordinates are kept with a warning.
  • Public display is controlled by show_address, addr_display_mode and show_map.

2. Configure the Phone field (phonenumbers)​

  1. In field configuration:
    • Use country code (use_cc): displays the country selector;
    • Default country (ac_country_default) and Allowed countries (ac_country_allowed_list);
    • Phone parts (use_phone): 1, 2 or 3 parts (prefix, area, number);
    • Max length, Size, Allow letters;
    • display of label, country code, area code and tel: link (add_tel_link).
  2. In 5.5, if no country is allowed, the field loads all available country codes: the selector is no longer empty.
  3. If only one country is allowed, the selector is locked (disabled + readonly) and the value is kept in a hidden field.

Value normalization​

Separators and the + sign are removed on save: +1 441 becomes 1441, +886 becomes 886. The tel: link is built from the cleaned value.

warning

Normalization does not automatically add +. Invalid entries (for example javascript:1, +1-441, ++1) are emptied on save: check values imported from CSV.

See also​