Display Map on Form using Google Map API

Thanks for the feedback Ron!

Thanks Jo-Anne,

That works much better. Now it displays even the first selected address’ map. I guess I was “sort-of” correct that the variables didn’t yet have scope. But maybe a better description isn’t about scope, but they just hadn’t yet been loaded.

Your new function brings up a question or 3:

I guess saying “if (lastField)” is shorthand for “does lastField have a value?” rather than a boolean if condition?

I’m not familiar with setTimeout. I presume it means "execute this code (within the braces) after this timeout, right?

I see you put the relevant code in a function so it can be called from multiple places depending on value of lastField. I’m curious about the placement of the internal function. In JavaScript, does the function need to be declared BEFORE you call it from your code?

I don’t quite understand the concept of the event being shadowed by another control. Did you move the control around on the form also?

As promised, the reworked code now allows the “real” google map to display in a new window. However it opens up a window which seems to be attached to Five. Not actually attached, but belonging to Five. Is there an easy way to request that it be opened in the default browser? Preferably a new tab of the browser?

Again, thanks sooooo much for all of your help!

Hi Ron,

  1. Yes you are correct, its ensuring the last field is not undefined and not null. (very JavaScript thing)
  2. Correct.
  3. With JavaScript the function can be declared anytime.
  4. The event attached to a higher level div in the html body might of been intercepting the event before the attached event.
  5. In your function just remove the line alert(url) that should get rid of the extra popup window. In regards to opening in a default browser are using desktop or cloud edition?

Hi Jo-Anne,

For now, I’m using the desktop version. I presume the cloud version is for when I choose a paid plan and the application is hosted online?

Either way, it makes sense for the map to open up in your current default browser. If a browser window is already open, it should be activated and a new tab should be added with the map. If browser is not open, it should open with the map. Are you saying that with the online version it will work properly? If that’s the case, I can live with a Five browser opening for now, although I’d prefer my default browser. Is there an option in the window.open command to tell it to use the default browser?

It seems the standard to open your browser and/or add a new tab and show the map.

I have removed the alert, so only the map opens.