Skip to content
This repository has been archived by the owner on Nov 8, 2017. It is now read-only.

Any update on getting formatted address working again? #320

Open
shornuk opened this issue Mar 13, 2017 · 1 comment
Open

Any update on getting formatted address working again? #320

shornuk opened this issue Mar 13, 2017 · 1 comment

Comments

@shornuk
Copy link

shornuk commented Mar 13, 2017

Got this working OK passing lat/long to my hidden form fields, but I also want to save the formatted address which currently doesn't update when the marker is moved. Any ideas on when or how this can be fixed?

@pion139
Copy link

pion139 commented May 2, 2017

This code works in my case:

      var geocoder = new google.maps.Geocoder();
      $("#geocomplete").bind("geocode:dragged", function(event, latLng){
        $("input[geocompname=lat]").val(latLng.lat());
        $("input[geocompname=lng]").val(latLng.lng());
        map.panTo(latLng);
        geocoder.geocode({'latLng': latLng }, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
            if (results[0]) {
              $("input[geocompname=formatted_address]").val(results[0].formatted_address);
            }
          }
        });
      });

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants