Thanks Tony, that's helpful. (I had to change this line to include quotes as shown:
Code:
var mapSGQA = '{SGQ}';
But anyway, it works as it was expected to work, that is, if a user just
Clicks on the map, then the code runs, however when selecting a location, users rarely just click on the map in this way, generally they'd either scroll right to the desired location and
Drag the marker to there (doesn't count for the Click event) or they'd
Right Click to place the marker at the desired location (also doesn't count). I didn't see an event for either of these actions on the Google Developer page. If you have any idea, please let me know.
Also, I am trying to add a search bar for geocoding addresses. The code I entered for some reason, changes the page to go to the Limesurvey Welcome page (where you choose your language and select available surveys on my host). This happens whether or not I enter an address in the search bar. Any ideas?
Code:
<input id="search_address" type="text" value="" /><button onclick="search()">Search</button>
<script type="text/javascript">
var addressField = document.getElementById('search_address');
var geocoder = new google.maps.Geocoder();
function search() {
geocoder.geocode(
{ 'address': addressField.value },
function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var loc = results[0].geometry.location;
// use loc.lat(), loc.lng()
alert(loc.lat());
}
else {
alert("Not found: " + status);
}
}
);
};
</script>
R
LimeSurvey
Version 2.00+ Build 130514