0
votes

I'm new to Google maps and I'm wondering how would I program a Map which would pop out a HTML form when the user clicked a location on the map? I'd like the form to "pop out" of the map on screen. is this possible?

I've got the following...

         <script>
        var contentString = '<div id="content">
       <form action="welcome.php" method="post">
       <b>Name</b><br/> <input type="text" name="fname" />
       <br/><b>Description</b><br/>
       <TEXTAREA NAME="description" COLS=40 ROWS=6></TEXTAREA><br/><br/>
       <b>Latitude</b><br/><INPUT name="lat" id ="lat" /><br/>
       <b>Longitude</b><br/><INPUT name="lng" id ="lng" /><br/>
       <input type="submit" />
       </form>
       </div>';

var infowindow = new google.maps.InfoWindow({ content: contentString });

My on click listener is...

GEvent.addListener(map, "click", function(overlay, latLng)
{
    if (latLng) {
 marker = new GMarker(latLng, {draggable:true});
 map.addOverlay(marker);
 infowindow.open(latLng, map);
  }

    // display the lat/lng in your form's lat/lng fields
    document.getElementById("lat").value = latLng.lat();
    document.getElementById("lng").value = latLng.lng();
});

  }
}

What I want is on click It'll open a HTML form at the location where the user clicked and pass on the lat/lng fields to the HTML form. is this possible?

1
Do you mean something like the example on this page: garshol.priv.no/blog/17.htmlMike

1 Answers

2
votes

All the information you need is in the documentation, along with an example - all you need to do is put the HTML form in there.