Skip to content

Commit

Permalink
minor change to geocoder lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
uniqu3 committed May 12, 2014
1 parent c701014 commit f2aa63d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/fielddefs/GeoCoder/input.GeoCoder.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,20 @@
callback: function () {
// Init GeoCoder
var geocoder = new google.maps.Geocoder();
var geocoder = new google.maps.Geocoder(),
address = $('[name="m1_customfield[2]"]').val(); // change to smarty name attrribute value
// Marker setup
geocoder.geocode({ 'address' : '{$fielddef->Address()}' }, function(results, status) {
geocoder.geocode({ 'address' : address }, function(results, status) {
if(status === google.maps.GeocoderStatus.OK) {
//console.log(results);
var lat = results[0].geometry.location.lat(),
lng = results[0].geometry.location.lng();
$("#{$actionid}customfield_{$fielddef->GetId()}_lat").val(results[0].geometry.location.d);
$("#{$actionid}customfield_{$fielddef->GetId()}_lon").val(results[0].geometry.location.e);
console.log(results[0].geometry.location);
$("#{$actionid}customfield_{$fielddef->GetId()}_lat").val(lat);
$("#{$actionid}customfield_{$fielddef->GetId()}_lon").val(lng);
}
});
}
Expand Down

0 comments on commit f2aa63d

Please sign in to comment.