• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: google maps

google maps 9 years 7 months ago #28690

:dry:

Hi guys,

I'm trying to do something I thought would be repetitively simple yet I think I am missing something.

What I am trying to do is have 3 separate fields populate and update the google map marker and center on it. (ie Street Address, Suburb, Post code.) add them all to one javascript variable and then update the map.

So far I have only been able to replicate the google auto text list. That means the user still has to click the link to get the map to update. I was looking at simulating the click but I couldn't do this as the links are javascript_voids.

I was wondering if someone has a solution for me.

The code I have added is as follows:
jQuery(document).ready(function() {
 
  jQuery('input').on('blur', function() {
   var mapLoc= jQuery('input#propMap').val();
   var postCode =  jQuery('input#Postcode').val();
   var streetAdd =  jQuery('input#propStAddress').val();
   var suburb=  jQuery('input#propSuburb').val();
   var country = 'Australia';
 
  jQuery('#propMap').val(streetAdd + ', '+ suburb + ', ' + postCode + ',  ' + country);
 
  jQuery('#Postcode').on('blur', function() {
 
     term = jQuery('#propMap').val();
     rsfp_geolocation(term,48,'propMap',rsformmap48,rsformmarker48,geocoder, 1);
 
    })
  })
});
The administrator has disabled public write access.

google maps 9 years 7 months ago #28698

If anyone is interested I created a new function based off the rsform function with some minor alterations to get this working... I'll be the first to admit the code is crude but it gets the job done.
<script>
 
function rsfp_UPDATEgeolocation(term, id, mapid,  map, marker, geocoder, type) {
	var content = document.getElementById('rsform_geolocation'+id);
	var address	= document.getElementById(mapid).clientWidth;
 
	document.getElementById('rsform_geolocation'+id).style.width = address+'px';
	document.getElementById('rsform_geolocation'+id).style.display = 'none';
	document.getElementById('rsform_geolocation'+id).innerHTML = '';
 
	if (term != '') {
		geocoder.geocode( {'address': term }, function(results, status) {
			if (status == 'OK') {
				for (var i=0; i<results.length; i++) {
					var item	= results[i];
					var theli	= document.createElement('li');
					var thea	= document.createElement('a');
 
					thea.setAttribute('href','javascript:void(0)');
					thea.innerHTML = item.formatted_address;
 
					var location = new google.maps.LatLng(item.geometry.location.lat().toFixed(5), item.geometry.location.lng().toFixed(5));					
					var mapValue = type ? item.formatted_address : item.geometry.location.lat().toFixed(5) + ',' + item.geometry.location.lng().toFixed(5);
					var mapId	 = mapid;
 
					document.getElementById(mapId).value = mapValue;							
					marker.setPosition(location);
					map.setCenter(location);
					document.getElementById('rsform_geolocation'+id).style.display = 'none';
 
					//hide the list
					//theli.appendChild(thea);
					//content.appendChild(theli);
				}// end the if iteration
 
			document.getElementById('rsform_geolocation'+id).style.display = '';
			}// end if "ok"
		});// end geocoder
	}
}
 
jQuery(document).ready(function() {
 
  jQuery('#Postcode').on('blur', function() {
   var mapLoc= jQuery('input#propMap').val();
   var postCode =  jQuery('input#Postcode').val();
   var streetAdd =  jQuery('input#propStAddress').val();
   var suburb=  jQuery('input#propSuburb').val();
   var country = 'Australia';
 
     jQuery('#propMap').val(streetAdd + ', '+ suburb + ', ' + postCode + ',  ' + country);
     term = jQuery('#propMap').val();
     rsfp_UPDATEgeolocation(term,48,'propMap',rsformmap48,rsformmarker48,geocoder, 1);
 
  })
});
</script>
The administrator has disabled public write access.
The following user(s) said Thank You: anthony.burge, Roberts, cosmin.cristea, Isengo

google maps 9 years 3 months ago #29968

  • Isengo
  • Isengo's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 18
  • Thank you received: 2
Hello Matthew, this is exactly what I am looking for. But I don't get a few things in this script. For example the rsformmarker48, what is this for?
The administrator has disabled public write access.

google maps 9 years 3 months ago #29994

  • Isengo
  • Isengo's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 18
  • Thank you received: 2
Still not working right. I can fill out the Geolocation Search, but itś still not updating by itself. can someone please help or is it more efficient if I open a ticket? This is one of the mandatory things why I got RSFORM! Pro...
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!