Problem/Motivation
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.
Comment | File | Size | Author |
---|---|---|---|
#12 | geocoding_not_working-2022481-12.patch | 8.72 KB | sumitmadan |
Comments
Comment #1
josebc CreditAttribution: josebc commented+1 having same issue, any luck ?
Comment #2
josebc CreditAttribution: josebc commentedmoving to gmap
Comment #3
ArrowI am also seeing this issue. A javascript error occurs when clicking the "Find Address on Map" button.
Comment #4
ArrowSeems 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.
Comment #5
balajidharma+1 having same issue.
Comment #6
m33_nft CreditAttribution: m33_nft commented+1 We have to go into editing again, and press the find adress on map
Comment #7
podarokmoving to dev
Comment #8
m33_nft CreditAttribution: m33_nft commentedHey 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) {
and replace code into "if (status == google.maps.GeocoderStatus.OK) {"
Sorry for stupid code, but my content-manager can work now )) good luck
Waiting for real fix =)
Comment #9
madhusudanmca CreditAttribution: madhusudanmca commentedHi 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!!
Comment #10
m33_nft CreditAttribution: m33_nft commentedAny news? When will the fix?
Comment #11
yaelsho CreditAttribution: yaelsho commentedHello,
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
Comment #12
sumitmadan CreditAttribution: sumitmadan at QED42 commentedI 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.
Comment #13
fyberoptik CreditAttribution: fyberoptik commentedAfter 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
Comment #14
podarokdue to #13
Comment #15
sumitmadan CreditAttribution: sumitmadan at QED42 commentedHi @padarok,
Moving back to needs to review according to edited #13 comment. :)