Home › Forums › ACF PRO › ACF Pro Address Field Replacement › Reply To: ACF Pro Address Field Replacement
I believe it should be possible to get the below api response from google places api for an autocomplete address or from a lat/lng position pretty consistently (same principle is implemented in the Drupal Get Locations plugin). If some or all of the response is not present (e.g. a lat/lng in the ocean) the city/state/country field could be left empty. Shouldn’t this cover most use cases?
I will see if I can make this work with Elliot’s suggestion about the google_map_change event and hidden fields. But a native solution would be much more preferable.
“result” : {
“address_components” : [
{
“long_name” : “Amsterdam”,
“short_name” : “Amsterdam”,
“types” : [ “locality”, “political” ]
},
{
“long_name” : “Government of Amsterdam”,
“short_name” : “Government of Amsterdam”,
“types” : [ “administrative_area_level_2”, “political” ]
},
{
“long_name” : “North Holland”,
“short_name” : “NH”,
“types” : [ “administrative_area_level_1”, “political” ]
},
{
“long_name” : “Netherlands”,
“short_name” : “NL”,
“types” : [ “country”, “political” ]
}
],
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.