I am trying to figure out if there is a way to select the applicable city, if multiple exist, when entering an address. Currently I have a function that utilizes Google Maps Geocode API to search by zip code returns the city, state, and county but the problem at hand is sometimes some zip codes apply to multiple Cities. For Instance:
{
"results" : [
{
"address_components" : [
{
"long_name" : "33707",
"short_name" : "33707",
"types" : [ "postal_code" ]
},
{
"long_name" : "Gulfport",
"short_name" : "Gulfport",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Pinellas County",
"short_name" : "Pinellas County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Florida",
"short_name" : "FL",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Gulfport, FL 33707, USA",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 27.777283,
"lng" : -82.69842709999999
},
"southwest" : {
"lat" : 27.733506,
"lng" : -82.75803289999999
}
},
"location" : {
"lat" : 27.7514295,
"lng" : -82.7293193
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 27.777283,
"lng" : -82.69842709999999
},
"southwest" : {
"lat" : 27.733506,
"lng" : -82.75803289999999
}
}
},
"place_id" : "ChIJGQLbYbbiwogRcF0Dd7N9znU",
"postcode_localities" : [ "Gulfport", "South Pasadena", "St. Pete Beach", "St. Petersburg" ],
"types" : [ "postal_code" ]
}
],
"status" : "OK" }
I've created a form "Select City" in zoho creator which is nothing more than a single dropdown field which could be used to return the list of cities to for selecting. I just have no idea how to put it all together, if possible.
The preferable function would do the following:
Make Call to Google Maps API URL searching by Zip Code
If multiple cities exist;
Open "Select City" form as a pop-up with the applicable options in the drop down field
Select City
Populate address fields the correct city, state, and county
If only one city applies to zip code
Populate address fields the correct city, state, and county
Also, while on this topic, I have another rule/function that consolidates all the address fields to one single multiline field but find that the two functions conflict with each other sometimes because one function, the Google Maps API, is triggered when the zip code is entered and the other, the concentration of the address, is triggered whenever created or edited because you cannot select street, city, state, and zip (all together) as a trigger for a function, only allows up to three fields. If any work around, I'm open to all options.