On Dec 4, 10:16 am, jul <[email protected]> wrote:
> hi,
>
> I'm doing some geocoding using the google maps API. The user fill a
> form with some address, and when the submit button is clicked, a
> codeAddress() function is called, which is supposed to perform the
> geocoding, but it does not work. As a test, I hardcoded the address
> and call the codeAddress function when the document in an initialize
> (). When codeAddress is called when the page is ready, it works ok,
> but when it's called by the onclick script, it doesn't work (no errors
> returned by firebug!).

What happens with <form action="">?

You click the button and the onclick event fires and sends off the
geocode request. While that is "in flight", the page carries on
processing and does the form action, which is to reload the page. When
the geocode request is returned, the page is no longer listening for
it.

Try using onclick="codeAddress();return false;" to suppress the
default action. This is basic event handling, nothing to do with maps.

> (you can paste the code below in 
> here:http://code.google.com/apis/ajax/playground/?exp=maps#map%5Fsimple, or
> change the google api key)

I could. But then you could follow the posting guidelines and provide
a link so we can all run Firebug.

Andrew

--

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