I'm using the location_node module to assign a location to each of the event nodes on my site. The events can happen anywhere in the world. I've noticed that if I enter in an address with the default, pre-selected country (UK), and then click on the 'find address on map' button, then the geocoding works. If, however, I change the country to say US, and enter in a US address, then the 'find address on map' button no longer works. Even if I return to the UK setting and re-enter the UK address, it still doesn't work. I have to save the node, re-edit and then click on the 'find address on map' button again.

Basically the 'find address on map' button only works for the country populated in the form on initial page load, as soon as you change the country, the geocoding stops working.

I'm wondering if Drupal behaviours need to be re-attached or something? but don't rightly know.

#12 geocoding_not_working-2022481-12.patch8.72 KBsumitmadan
PASSED: [[SimpleTest]]: [MySQL] 145 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


josebc’s picture

+1 having same issue, any luck ?

josebc’s picture

Project: Location » GMap Module
Version: 7.x-3.0-rc1 » 7.x-2.7

moving to gmap

Arrow’s picture

I am also seeing this issue. A javascript error occurs when clicking the "Find Address on Map" button.

TypeError: m.change is not a function
Line 27

Arrow’s picture

Seems the Drupal.gmap.getMap(gmap_id) function is returning false rather than an object. This normally works, but once you change the country, it loses the ability to find the map. Not sure why though.

balajidharma’s picture

+1 having same issue.

m33_nft’s picture

+1 We have to go into editing again, and press the find adress on map

podarok’s picture

Version: 7.x-2.7 » 7.x-2.x-dev

moving to dev

m33_nft’s picture

Hey guys I have a stupid decision (since I know nothing about js)
First, use default counry, in select list

just add before $("button.location-gmap-find-address-button").click(function (e) {

 $( document ).ready(function() {

and replace code into "if (status == google.maps.GeocoderStatus.OK) {"

 var m = Drupal.gmap.getMap(gmap_id);
                            if (typeof m === 'object')
                                m2 = m;
                                m.locpick_coord = results[0].geometry.location;
                                m2.locpick_coord = results[0].geometry.location;

Sorry for stupid code, but my content-manager can work now )) good luck
Waiting for real fix =)

madhusudanmca’s picture

Hi All,

The trick to wrap the click "$( document ).ready();" worked for me as described in comment #8 by m33_nft. However no need to go for second trick given there, it may cause more errors.

Thanks m33_nft for giving trick!!

m33_nft’s picture

Any news? When will the fix?

yaelsho’s picture

I complete the change per m33_nft suggestion which fixed the 'find address on map' button malfunction issue.
I had to put both parts in order to make it work.

p.s. before I made the fix per #8 the 'find address on map' stop working post any ajax activity, e.g- changing country= ajax to find the new province list, upload image = ajax loading. Now after the change the 'find address on map' button works post both of them.

The issue with this fix is that every time you are editing the node with location field, or every time you upload new image, it reset the coordinator chooser. Which is unwanted affect in case the user already define the exact coordinates he want, he will lose it and need to redefine them every time he would like to edit his content.

Since I couldn't find better solution, I had to disable this great feature.
Thanks, Yael

sumitmadan’s picture

Issue summary: View changes
Status: Active » Needs review
8.72 KB
PASSED: [[SimpleTest]]: [MySQL] 145 pass(es). View

I have used latest dev branch and this issue has been fixed. But there was one more issue, alert box was coming multiple times when you change the country and no address found there.

I have created a patch to fix that.

fyberoptik’s picture

After applying patch #12 against the current dev Gmap module, I have lost the google map completely.

The following error is printed to the console in chrome:

jquery.min.js?v=1.7.2:2 Uncaught TypeError: Cannot read property
'toLowerCase' of undefinedf.fn.extend.val @ jquery.min.js?v=1.7.2:2Drupal.behaviors.mjh_views_alter.attach @ location_gmap_find_address.js?nu3v34:4(anonymous function) @ drupal.js?nu3v34:76e.extend.each @ jquery.min.js?v=1.7.2:2Drupal.attachBehaviors @ drupal.js?nu3v34:74(anonymous function) @ drupal.js?nu3v34:481f.Callbacks.o @ jquery.min.js?v=1.7.2:2f.Callbacks.p.fireWith @ jquery.min.js?v=1.7.2:2e.extend.ready @ jquery.min.js?v=1.7.2:2c.addEventListener.B

@ jquery.min.js?v=1.7.2:2

EDIT: Found pending update for gmap, ran update, map started working. Thanks @sumitmadan

podarok’s picture

Status: Needs review » Needs work

due to #13

sumitmadan’s picture

Status: Needs work » Needs review

Hi @padarok,

Moving back to needs to review according to edited #13 comment. :)