Ok I decided to go with this....

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/
>
    <title>Google Maps</title>
    <script src="http://maps.google.com/maps?
file=api&amp;v=2&amp;key=key" type="text/javascript"></script>
  </head>
  <body onunload="GUnload()">


<form name="billgoat" action="google_map_test_action.cfm"
method="post">
<input type="hidden" name="lat" value="38.93714"   id="click_lat"
onclick="this.blur()">&nbsp;
<input type="hidden" name="long" value="-97.20632" id="click_long"
onclick="this.blur()">&nbsp;
<input type="submit" name="Save">
</form>

    <div id="map" style="width: 400px; height: 300px"></div>
    <script type="text/javascript">
    //<![CDATA[


    var map = new GMap(document.getElementById("map"));
    map.addControl(new GSmallMapControl());


    // center and zoom to the lat/long in the form
    map.centerAndZoom(new GPoint(
                document.getElementById('click_long').value,
                document.getElementById('click_lat').value), 9);


    GEvent.addListener(map, 'click',
        function(overlay, point) {
            if (point) {
                document.getElementById('click_lat').value = point.y;
                document.getElementById('click_long').value =
point.x;
            }
        }
    );
    //]]>
    </script>



  </body>

</html>






However, I still need two very important features.  1 - When the user
clicks I want to display a pinpoint.  2 - If the user clicks again I
want to take away the initial pinpoint and add one where the new click
was.

Any advice/assistance is greatly appreciated.

Thanks!!!!



On Dec 9, 8:13 am, aidema <[email protected]> wrote:
> Mike,
>
> Your tutorial is good but it looks like it stores the data to a file
> on the server.
>
> When the user clicks a pinpoint and then enters details into the popup
> ballopn and presses submit, I want the form to process and navigate to
> another page.
>
> Currently this is not working for me.
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> <html>
>   <head>
>     <meta http-equiv="content-type" content="text/html; charset=UTF-8"/
>
>     <title>Google Maps</title>
>     <script src="http://maps.google.com/maps?
> file=api&amp;v=2&amp;key=mykey" type="text/javascript"></script>
>   </head>
>   <body onunload="GUnload()">
>
>     <div id="map" style="width: 550px; height: 450px"></div>
>     <a href="store.htm">Back to the tutorial page</a>
>
>     <noscript><b>JavaScript must be enabled in order for you to use
> Google Maps.</b>
>       However, it seems JavaScript is either disabled or not supported
> by your browser.
>       To view Google Maps, enable JavaScript by changing your browser
> options, and then
>       try again.
>     </noscript>
>
>     <script type="text/javascript">
>
>     if (GBrowserIsCompatible()) {
>
>       var lastmarker;
>       var iwform = 'Enter details:<br>'
>                  + '<form name="submitit" onsubmit="process(this);
> return false" action="google_map_test_action.cfm">'
>                  + '  <textarea name="data" rows="5" cols="40"><\/
> textarea><br>'
>                  + '  <input type="submit" value="Submit" />'
>                  + '<\/form>';
>
>       // == creates a draggable marker with an input form ==
>       function createInputMarker(point) {
>         var marker = new GMarker(point,{draggable:true,
> icon:G_START_ICON});
>         GEvent.addListener(marker, "click", function() {
>           lastmarker = marker;
>           marker.openInfoWindowHtml(iwform);
>         });
>         map.addOverlay(marker);
>         marker.openInfoWindowHtml(iwform);
>         lastmarker=marker;
>         return marker;
>       }
>
>       // == creates a "normal" marker
>       function createMarker(point,text) {
>         var marker = new GMarker(point);
>         GEvent.addListener(marker,"click", function() {
>           marker.openInfoWindow(document.createTextNode(text));
>         });
>         map.addOverlay(marker);
>         return marker;
>       }
>
>       // == Display the map, with some controls and set the initial
> location
>       var map = new GMap2(document.getElementById("map"),
> {draggableCursor:"default"});
>       map.addControl(new GLargeMapControl());
>       map.addControl(new GMapTypeControl());
>       map.setCenter(new GLatLng(43.907787,-79.359741),8);
>
>       // == Listen for map click and add an input marker
>       GEvent.addListener(map,"click",function(overlay,point){
>         if (!overlay) {
>           createInputMarker(point);
>         }
>       });
>
>       function process(form) {
>         // == obtain the data
>         var details = form.data.value;
>         var lat = lastmarker.getPoint().lat();
>         var lng = lastmarker.getPoint().lng();
>         var url = "myserver.php?lat=" +lat+ "&lng=" +lng+
> "&details="+details;
>
>         // ===== send the data to the server
>         GDownloadUrl(url, function(doc) {    });
>
>         // == remove the input marker and replace it with a completed
> marker
>         map.closeInfoWindow();
>         var marker = createMarker(lastmarker.getPoint(),details);
>         GEvent.trigger(marker,"click");
>
>       }
>
>       // === Define the function thats going to read the stored data
> ===
>       readData = function(doc) {
>         // === split the document into lines ===
>         lines = doc.split("\n");
>         for (var i=0; i<lines.length; i++) {
>           if (lines[i].length > 1) {
>             // === split each line into parts separated by "|" and use
> the contents ===
>             parts = lines[i].split("|");
>             var lat = parseFloat(parts[0]);
>             var lng = parseFloat(parts[1]);
>             var details = parts[2];
>             var point = new GLatLng(lat,lng);
>             // create the marker
>             var marker = createMarker(point,details);
>           }
>         }
>       }
>       // === read data entered by previous users ===
>       GDownloadUrl("details.txt", readData);
>
>     }
>
>     // display a warning if the browser was not compatible
>     else {
>       alert("Sorry, the Google Maps API is not compatible with this
> browser");
>     }
>
>     </script>
>   </body>
>
> </html>
>
> On Dec 8, 1:02 pm, Rossko <[email protected]> wrote:
>
>
>
> > Have a look 
> > athttp://groups.google.com/group/google-maps-api/browse_thread/thread/2...- 
> > Hide quoted text -
>
> - Show quoted text -

--

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