title: Trouble adding event Listener on Drupal Gmap map
body: <p>I'm trying to write a Drupal module that will add UTM coordinate fields to a location form, such that they'll interact properly with the GMap map as well as the Latitude and Longitude fields - i.e. when the map is clicked, the UTM coordinates get calculated and populated along with the Lat/Long ones, and if the Lat/Long coordinates are changed by typing in the fields, the UTM coordinates change also, as well as the map, and vice versa.</p>
  
  <p>I have the translation and everything else working except for clicking the map. I'm trying to add a Listener to the map so that when it's clicked, a change event will get triggered on the lat/long fields, which would in turn trigger the updating of the UTM fields.  But, I can't seem to get the Listener to work. here's what I have so far (this is a snippet of my js file for my module, location_utm.js):</p>
  
  <pre><code>$(document).ready(function() {
      var themap = document.getElementById("gmap-auto1map-gmap0");
  
      Drupal.gmap.addHandler('gmap', function (themap) {
        var obj = this;
  
        var clickListener = GEvent.addListener(obj, "click", function() {           
  
           /* when the map gets clicked, trigger change event on the lat/long 
            fields so that the utm fields get updated too.   */
           $('#gmap-auto1map-locpick_longitude0').change();
           $('#gmap-auto1map-locpick_latitude0').change();
  
  
  
        });
     });
  });
  </code></pre>
  
  <p>I've tried a lot of different slight variations of this code but can't seem to get it right. I appreciate any advice.</p>