This is really cool stuff! Thanks so much for your hard work and for your help here.
my questions:
Is it possible to add records to the multiplier using javascript? How do i reference the fields in the multiplier from javascript?
what i'm trying to do:
I have a google map in my chronoform. when the user clicks on the map a marker is added. I expect the user to add multiple markers. I would like to add the marker coordinates and an identifier to fields in the multiplier. I want the data in the multiplier so it can be saved to the database, added to email, etc. I'm not trying to be vague, just to the point. please let me know if i can elaborate on anything. below is the javascript i already have and attached is a backup of the form so far.
JS Code:
JS Files
my questions:
Is it possible to add records to the multiplier using javascript? How do i reference the fields in the multiplier from javascript?
what i'm trying to do:
I have a google map in my chronoform. when the user clicks on the map a marker is added. I expect the user to add multiple markers. I would like to add the marker coordinates and an identifier to fields in the multiplier. I want the data in the multiplier so it can be saved to the database, added to email, etc. I'm not trying to be vague, just to the point. please let me know if i can elaborate on anything. below is the javascript i already have and attached is a backup of the form so far.
JS Code:
// JavaScript source code
jQuery(document).ready(function (jQ)
{
var map;
var markers = [];
var markerID = 1;
jQ('#geocode').click(codeAddress);
geocoder = new google.maps.Geocoder();
function initialize()
{
var startLocation = new google.maps.LatLng(33.0196287, -116.8384254);
var mapOptions = {
zoom: 8,
center: startLocation,
mapTypeId: google.maps.MapTypeId.ROAD
};
map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
google.maps.event.addListener(map, 'click', function (event)
{
addMarker(event.latLng);
});
}
function addMarker(location, label)
{
var marker = new google.maps.Marker(
{
position: location,
map: map,
draggable: true,
title: markerID.toString()
});
google.maps.event.addListener(marker, 'rightclick', function (event)
{
removeMarker(marker);
});
markers.push(marker);
markerID++;
}
function removeMarker(currentMarker)
{
if (confirm("Do you wish to remove sign " + currentMarker.title + " from the map?"))
{
currentMarker.setMap(null);
for (var i = 0; i < markers.length; i++)
{
if (markers[i].getPosition().equals(currentMarker.getPosition()))
{
var index = markers.indexOf(currentMarker);
markers.splice(index, 1);
break;
}
}
}
}
function codeAddress()
{
var address = jQ('#address_openhouse').val();
geocoder.geocode({ 'address': address }, function (results, status)
{
if (status == google.maps.GeocoderStatus.OK)
{
map.setCenter(results[0].geometry.location);
map.setZoom(15);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
title: "Open House",
icon: {
path: google.maps.SymbolPath.CIRCLE,
scale: 5
}
});
google.maps.event.addListener(marker, 'rightclick', function (event) {
removeMarker(marker);
});
markers.push(marker);
}
else
{
alert("Google couldn't find that address for the following reason: " + status);
}
});
}
google.maps.event.addDomListener(window, 'load', initialize);;
});
JS Files
https://maps.googleapis.com/maps/api/js?v=3.exp