Add a Google address field to load full address from Google or Display a Google map on your form.

cruser 23 Aug, 2022
Is this available in CF7 yet? If so, where?

Google Address/Map
Add a Google address field to load full address from Google or Display a Google map on your form.
GreyHead 24 Aug, 2022
Hi cruser,

I don't see that available in CFv7. You would need to use Custom Code to add the functionality to your form.

Bob
cruser 24 Aug, 2022
I was afraid that was the case. I've played around with this code and it works! But how do I pass the city2, cityLat, and cityLng to email when the form is submitted?
<script src="https://maps.googleapis.com/maps/api/js?key=editedforprivacy&libraries=places&callback=initAutocomplete"></script>
<script type="text/javascript">
function initialize() {
var input = document.getElementById('searchTextField');
var autocomplete = new google.maps.places.Autocomplete(input);
google.maps.event.addListener(autocomplete, 'place_changed', function () {
var place = autocomplete.getPlace();
document.getElementById('city2').value = place.name;
document.getElementById('cityLat').value = place.geometry.location.lat();
document.getElementById('cityLng').value = place.geometry.location.lng();
//alert("This function is working!");
//alert(place.name);
// alert(place.address_components[0].long_name);

});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<input id="searchTextField" type="text" size="50" placeholder="Enter a location" autocomplete="on" runat="server" />
<br />
<br />
<input type="" id="city2" name="city2" />
<input type="" id="cityLat" name="cityLat" />
<input type="" id="cityLng" name="cityLng" />
<br />
<br />
cruser 24 Aug, 2022
I got it figured out, this time with my glasses on.
You need to login to be able to post a reply.