rjnicholds Posted September 20, 2019 Share Posted September 20, 2019 (edited) For one of my client websites, the customer has requested an 'autofill' segment for addresses, based on location. I wondered if there were any existing plugins or any advice on how to do this in the squarespace form. I've strong familiarity with HTML and CSS, but not so much with Javascript and other languages. I've come across this online, but I'm unsure if it can be implemented on Squarespace...https://www.solodev.com/blog/web-design/adding-an-auto-complete-address-field-to-your-forms.stml Thanks in advance. Edited September 20, 2019 by graphicpressryan Initial Revision Link to comment
Guest Posted April 4, 2020 Share Posted April 4, 2020 Hi @rjnicholds, GeoIP service technologies can help you access your visitors' locations based on their IPs. When it comes to autofill segments for address regarding visitors' physical location, I would suggest GeoLocation API. The API reveals a visitor's country, state, and city with Javascript code and simple variables. You don't have to code yourself. Simply drag and drop Javascript they provided. It will auto-select drop downs and auto-populate form input boxes with location information. Please see sample code. Hope it helps! geotargetly_country_name(); //gets visitor country name geotargetly_country_code(); //gets visitor country code geotargetly_region_name(); //gets visitor Region/State or state name geotargetly_region_code(); //gets visitor Region/State or state code geotargetly_city_name(); // gets visitor city name geotargetly_lat(); // gets visitor latitude geotargetly_lng(); // gets visitor longitude geotargetly_ip(); // gets visitor IP address geotargetly_loaded(); // gets called when data is available //----------------Example------------- function geotargetly_loaded(){ var country_name = geotargetly_country_name(); if (country_name == "United States"){ //do something } } Link to comment
shane411 Posted March 10, 2022 Share Posted March 10, 2022 Hi there! I have a similar request; were you able to make this work? If so, which solution did you move forward with? Thank you! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment