Hi there!

I have a content type which has an Image field with upload functionality and a Location field (field type: Location, widget type Location Field) as well.
Both of them uses ajax in the background.
After I upload an image the "Find address on map" button (Gmap) does not work.

I debuged the source and find that the Drupal.behaviors.GMap detach part cause this. (In gmap.js Ln 605)
If I do not upload any image It is working with no problem.

Could you help in this issue?

Drupal version: 7.20

CommentFileSizeAuthor
#3 drupal_behaviors_gmap-1993528-3.patch647 bytesalcroito

Comments

biosonic’s picture

I quickly solved this problem like this:

function HOOK_init() {
  // gmap find addres after uploading image
  if( arg(0)=='node' && (arg(2)=='edit'||arg(1)=='add') ) {
    drupal_add_js("jQuery(document).ready(function(){Drupal.behaviors.GMap={}});",'inline');
  }
}
alcroito’s picture

Version: 7.x-2.7-beta2 » 7.x-2.x-dev
Issue summary: View changes

The problem was introduced in #1399248: GMap jquery behaviour needs detach functionality. when the detach function was implemented.
It unloads the map objects, but forgets to remove the gmap-processed class.
Once the attach function is called after an ajax update, all maps still have "gmap-processed" class added, so the code does not initialize the maps again.

alcroito’s picture

StatusFileSize
new647 bytes

Attaching patch that solves the problem, by removing the 'gmap-processed' class when the detach handler is called.

alcroito’s picture

Status: Active » Needs review
podarok’s picture

Status: Needs review » Fixed

commited, thanks

  • podarok committed 1e9779c on 7.x-2.x authored by Placinta
    Issue #1993528 by Placinta: Drupal.behaviors.GMap detach functionality...
podarok’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.