Navigation überspringen

[Gelöst] Limit Google Map address locations to Germany via Toolset Forms

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

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 vor 4 Jahren, 6 Monaten. 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.

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)

Dieses Thema enthält 2 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von simonM-5 vor 4 Jahren, 6 Monaten.

Assistiert von: Christian Cox.

Author
Artikel
#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!