Skip Navigation

[Resolved] Limit Google Map address locations to Germany via Toolset Forms

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to limit the autocomplete address options in a Toolset Forms address field to be from a specific country, Germany.

Solution: Add the following JavaScript snippet to your Form's JS panel:

jQuery(document).ready(function(){
  jQuery(".js-toolset-maps-address-autocomplete").geocomplete({country: 'DE',type: []});
});
This support ticket is created 4 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1844225

Hi Support

We would like to limit the search scope of Google Maps to addresses within Germany.

I found the following in another post: https://toolset.com/forums/topic/limiting-maps-results/

I added the following to the affected views, and it works perfectly.
jQuery(".js-toolset-maps-distance-center").geocomplete({country: 'DE',type: []});

I tried adding the same code to the JS area of the Toolset form, but I am guessing it is being ignored because js-toolset-maps-distance-center is not present anywhere in the Form.

Is there any way to do the same for Toolset Forms? We would like to prevent users from creating posts with address locations outside Germany.

Thanks and regards
Simon

#1845041

Hello, try adding the following code in your Form's JS editor panel:

jQuery(document).ready(function(){
  jQuery(".js-toolset-maps-address-autocomplete").geocomplete({country: 'DE',type: []});
});

Let me know if this does not resolve the issue and I can take a closer look. Thank you!

#1846061

My issue is resolved now. Thank you!