Hi Ross,

Ok, one step closer to glory...:-)

The map it self is working now and I get the lng/lat to the texfield
after a search. The lat/lng does not get updated after I drag the
marker as it should and I do not get the address either.

The listener is now: GEvent.addListener(marker, "dragend",
getAddress);
And when I have ended the drag, shouldn't this trigger the getAddress-
function?

    function getAddress(latlng) {
            document.getElementById("lat").value=latlng.lat();
            document.getElementById("lng").value=latlng.lng();
            if (latlng != null) {
                 address = latlng;
                 geo.getLocations(latlng, showNewAddress);
                }
    }

Hmmm...what are the next steps I shoul take?

/Nimrod

On 7 Maj, 11:18, Rossko <[email protected]> wrote:
> > Should I do it like this?
>
> It's your code and there is always more than one way to do things.
> However, bearing mind the way your page works - a marker might get
> dragged or not etc. -
> I'd do something like
>
>       GEvent.addListener(marker, "dragend", getAddress)
>              // when fired, passes a GLatLng to whatever function is
> specified
> .....
>
>       function getAddress(latlng) {
>                 // needs to be passed a GLatLng
>             document.getElementById("lat").value=latlng.lat();
>             document.getElementById("lng").value=latlng.lng
>             if (latlng != null) {
>                  address = latlng;
>                  geo.getLocations(latlng, showNewAddress);
>             }
>       }
> // where showNewAddress takes the geocoder results (if any) and pastes
> them in your form
>
> The reason why I'd do it that way is so that I could re-use the same
> getAddress function from other parts of my code.  If was built
> directly in the listener, you can only ever use it on that one
> listener.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to