Rossko,
Thanks!
I have put the hidden form fields in the HTML-form as this;
<input type="hidden" name="lat" id="lat" value = "" />
The showAddress() function now looks like below.
I have added
document.getElementById("lat").value = p[1];
Is this correct? Well...i shouldn't be because I do not get the values
as I should...do You have any suggestions?
Thank you,
/Nimrod
function showAddress() {
var search = document.getElementById("search").value;
// ====== Perform the Geocoding ======
geo.getLocations(search, function (result)
{
map.clearOverlays();
if (result.Status.code == G_GEO_SUCCESS) {
// ===== If there was more than one result, "ask did you
mean" on them all =====
if (result.Placemark.length > 1) {
document.getElementById("message").innerHTML = "Did
you mean:";
// Loop through the results
for (var i=0; i<result.Placemark.length; i++) {
var p = result.Placemark[i].Point.coordinates;
document.getElementById("message").innerHTML +=
"<br>"+(i+1)+": <a href='javascript:place(" +p[1]+","+p[0]+")'>"+
result.Placemark[i].address+"<\/a>";
}
}
// ===== If there was a single marker, is the returned
address significantly different =====
else {
document.getElementById("message").innerHTML = "";
if (different(search, result.Placemark[0].address)) {
document.getElementById("message").innerHTML = "Did
you mean: ";
var p = result.Placemark[0].Point.coordinates;
document.getElementById("message").innerHTML += "<a
href='javascript:place(" +p[1]+","+p[0]+")'>"+ result.Placemark
[0].address+"<\/a>";
} else {
var p = result.Placemark[0].Point.coordinates;
place(p[1],p[0]);
document.getElementById("message").innerHTML =
"Located: "+result.Placemark[0].address;
document.getElementById("lat").value = p[1];
document.getElementById("lng").value = p[0];
}
}
}
// ====== Decode the error status ======
else {
var reason="Code "+result.Status.code;
if (reasons[result.Status.code]) {
reason = reasons[result.Status.code]
}
alert('Could not find "'+search+ '" ' + reason);
}
}
);
}
}
// display a warning if the browser was not compatible
else {
alert("Sorry, the Google Maps API is not compatible with this
browser");
}
On 2 Maj, 12:24, Rossko <[email protected]> wrote:
> > 1. The total form includes a map. The user search for a location.
> > Get's a marker. Then choose file to upload and add some text in the
> > text fields. Where in the Javascript should I have the hidden
> > formfields or shhould I have them in the javascript or in the <body>-
> > part of the site with the other form fields?
>
> Put your hidden <input> tags in the form you want the user to use for
> file upload etc.
> Give the tags some unque id= so you can find them easily from
> javascript.
>
> When your javascript has got the right lat/lng, use
> document.getElementById() to set the values of the hidden fields.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---