Hey. Is that the right link? I copied that one from the drop down, test box. That was the only place that i knew that had a public link...
Hi Troy,
Yes, I can open it. We'll test.
Thanks Katya! Does what I am trying to do with the map make sense?
Troy,
This will take some time. Working on it.
Hi Troy,
Add "Invoke service" action on "Map" screen "Load" event.
On "Map" screen "Data" - "Edit Mapping" add next JS.
for latitude field:
code
localStorage.setItem('latitude',value);
/code
for longitude field:
code
localStorage.setItem('longitude',value);
/code
Remove all JS code from "Directions" file and add next JS code to file :
code
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
function initialize() {
directionsDisplay = new google.maps.DirectionsRenderer();
}
function displayDirections(sourceAddress,destinationAddress, map) {
var request = {
origin: sourceAddress,
destination: destinationAddress,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
directionsDisplay.setMap(map);
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
} else {
alert("Directions query unsuccessful. Response status: " + status);
}
});
}
/code
Add input field to "Map" screen it would be for destination address, set name to "destAddress"
5 .On "GetDirections" button click remove old JS code and add new one:
code
var destinationAddress = Appery("destAddress").val();
var long = localStorage.getItem('longitude');
var latit= localStorage.getItem('latitude');
var sourceAddress = new google.maps.LatLng(latit,long);
var map = Appery("directionsMap").gmap;
displayDirections(sourceAddress,destinationAddress,map);
/code
Fix "Googlemap" name to "directionsMap".
Hello again,
Sorry this has been such a problem! I went to try it and I keep getting stuck where I am supposed to add the JS for latitude and longitude in step 2. I click on the green "Add JS" button but when I begin entering text it goes vertical and I can't see the "Save & Return" button any more.
What do I do?
Do you type or copy and paste the code?
HI!
We'll research about it deeply, as a quick fix do next: