Skip to main content
Inspiring
July 31, 2023
解決済み

Is there a free auto-complete model for adresses ? And if yes, what is it ?

  • July 31, 2023
  • 返信数 3.
  • 2163 ビュー

Hi. 

So I'm working on a form for my job, and my superior has asked me to find a way to generate the right city and the right postal code based on an address. So I've heard that Google Maps offer this kind of auto-complete option, but it's not free (we're a small business). Is there a free way to do it, maybe with JavaScript ?

Thank you.

このトピックへの返信は締め切られました。
解決に役立った回答 Nesa Nurani
Form.pdf

You need to use or (||) for multiple strings, like this:

if (event.value === "Walmart Inc." || event.value === "Walmart" || event.value === "walmart")

返信数 3

Inspiring
November 10, 2023

Hi, I have a little problem with the code. When I write the subsequent adresses with "else if", it completes the city and postal code field with the correspondant answer of the first adress. When I only write "If" for every adresses, it automatically fill the correspondant city and postal code fields with the last adress data. How to solve this problem ?

Nesa Nurani
Community Expert
Community Expert
November 10, 2023

Post the script you tried or the actual file (with script inside).

Inspiring
November 10, 2023
Form.pdf
Nesa Nurani
Community Expert
Community Expert
August 17, 2023

You can use this as 'Validation' script of "Address" field:

var city = this.getField("City");
var postal = this.getField("Postal code");

if(event.value == "Address1"){
city.value = "City1";
postal.value = "Postal code1";}

else if(event.value == "Address2"){
city.value = "City2";
postal.value = "Postal code2";}

else if(event.value == "Address3"){
city.value = "City3";
postal.value = "Postal code3";}

//add more 'else if' if needed

else{
city.value = "";
postal.value = "";}

Just change field names to your actual field names.

Inspiring
August 17, 2023

Thank you.

try67
Community Expert
Community Expert
August 1, 2023

Are you talking about JS in a PDF file, or in a web-page? Because this forum is about the former.

Inspiring
August 1, 2023

In a PDF file

try67
Community Expert
Community Expert
August 1, 2023

In that case then no, unless you embed the entire address DB into your file...