Skip Navigation

[Resolved] maps location autosuggest limit to country override not working

This support ticket is created 3 years, 1 month 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 6 replies, has 2 voices.

Last updated by herbie4 3 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#2181583

Tell us what you are trying to do?

I want to limt the auto suggest from de distance center field to just Netherlands.
I put this into the View loop editor JS tab.

jQuery(document).ready(function($){
$(".js-toolset-maps-distance-center").geocomplete({country: 'NL', type: []});
});

Is there any documentation that you are following?

Found this thread, but it is not working. If I type a postcode it still shows USA suggestions.
https://toolset.com/forums/topic/limit-google-map-address-locations-to-germany-via-toolset-forms/

#2181795

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share problem URL and admin access details so I can check why the code is not working.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2181823

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Unfortunately the admin access details you shared is not working at this end. Can you please send me working admin access details.

I have set the next reply to private which means only you and I have access to it.

#2181873

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've added the following JS code to your view's JS editor:

function initialize() {
  var input = document.getElementsByClassName('js-toolset-maps-distance-center');
  options = {
      language: 'en-GB',
      types: [],
      componentRestrictions: { country: "nl" }
    };
 
  var autocomplete = new google.maps.places.Autocomplete(input[0],options);
}
 
jQuery(document).ready(function($){
  google.maps.event.addDomListener(window, 'load', initialize);
});

Can you please confirm it works as expected.

#2181879

Hi Minesh,
I did not work correct, but I changed the options to:
options = {
language: 'nl-NL',
types: [],
componentRestrictions: { country: "NL" }
};
and now it is working correct. Thank you for putting me on the right track.

#2181881

My issue is resolved now. Thank you!

#2182991

Hi,
Looks like it isn't working after all. Can you have another look?
Best regards, hrbrt