• 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 Field

Google Maps Field 4 years 7 months ago #39412

Hey,

I need help configuring the google Maps field.

1. How to limit the google-maps search to just one country like this:
stackoverflow.com/questions/8282026/how-...ity-and-country-only

2. The google maps field returns a whole string for the adress. However I would like to divide and insert all the filds (street, house-number, city, postal-code) into hidden fields. How can I do that?



Thanks in advance
The administrator has disabled public write access.

Google Maps Field 4 years 5 months ago #39603

I'm not sure how to turn off the country, but I use javascript to split the address up into different parts. I'm sure there is probably a better way to do this, but this worked for me.

I make a Load Address button and use onclick just in case the address is an exception, but I suppose you could make it onchange and put it in the google maps additional attributes.

onchange="separateAddress();" or onclick="separateAddress();"

<script type="text/javascript">
function separateAddress(){
var longstr = document.getElementById("ProjectAddress").value;
var a = longstr.indexOf(",");
var num_matches = longstr.match(/,/gi).length;
if (num_matches === 4) {
var a = longstr.indexOf(",",a+1);
}
var b = longstr.indexOf(",",a+1);
var c = longstr.indexOf(",",b+1);
document.getElementById("address").value=longstr.substr(0, a);
document.getElementById("city").value=longstr.substr(a+2, b-a-2);
document.getElementById("state").value=longstr.substr(b+2, 2);
document.getElementById("zip").value=longstr.substr(b+5, 5);
}
</script>
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!