Address Input when typing a postcode doesn't provide property numbers, or displays fake addresses


Typing a postcode just provides the street, when I need the ADDRESS, this isn’t expected behaviour of an address lookup. How do I enable this lookup to provide addresses via a post code, or how do I change this input to use a good address API such as Royal Mail’s?

Also…


Only 1 of these is a real address, and Wix knows this, as if I click on a fake one, either nothing happens, or it just again puts the street in text box.

Example of RM’s that actually works:

Where is your code?

What code? Its literally an issue with the basic ‘Autocomplete Address’ input functionality. I’ve not coded it to bring back non existent addresses, or to purposefully miss off the property name/numbers.

If you do not use CODE → than your post is in the WRONG-SECTION.

I’ve come across your COMMENTS a lot in my 1 day of using Wix, you’re a “Top Contributor” but I’ve so FAR → I’ve not seen you leave a friendly or useful comment, only RUDE ones (like above) or POINTLESS ones… again like above .

  1. I’m asking in the -->CODE<-- section as I assume CODE would BE able to address the issue. I am using CODE, there just isn’t any to post-currently around this issue.

  2. Where do you suggest this issue be POSTED? Or do-you not UNDERSTAND → the issue I’ve clearly outlined ?

Anyway, your comment is useless and unhelpful, if this is the wrong section, then suggest the right section. As clearly I believed this to be the correct place to post.

Replying to Bob Smith
Ok, you have had your statement, now you will hear mine!

  1. I solve over 50-post a week.

  2. I see a lot of people who just need a CODE FOR FREE (without even tried to solve it on their own or just → using the SEARCH of this FORUM.

  3. I see every day people here, who even can not describe their own ISSUE and PROBLEM in → DETAIL !

Here you have your BEST-EXAMPLE for it…

Your post including (you are starting with your description from nowhere).
You must understand, that anybody can see what elements are used, how they are connected on your site and if you do not provide any code → it is even more difficult to give you a solution to your problem.

  1. Since you can not provide any code for the SEARCHBAR, i must assume, you never even tried to search for how to interact with the searchbar using CODE (because no code provided)

  2. Yes, you posted your post into the CODE-SECTION, than also an already prepared CODE is expected.

Because if you do not provide a CODE, it seems like you are expecting someone to generate code for you → and again we are refferig to CHECKPOINT-2.

About rude or not rude!
I am not really rude, just want to make things clear and let the post-opener be informed when he is doing failures.
Rude would be if someone who can help you would just ignore your post.

And about Royal …
developer.royalmail.net
API Library
…talking about this?

Hi Bob, i saw this and a few other related posts that have commented on reliable postal addresses so thought i’d share my experience here. First ever post so looking to give something back as i have benefited a lot from reading other posts and solutions (including Velo Ninja’s), getting on youtube etc. I’m certainly no Velo Ninja but hope it helps. This response is in a UK context.

The standard Wix address lookup is where i started just like you. I was looking to capture additional member info and i found similar issues that it didn’t always correctly send this to Contacts so often the postal address would be incorrect. A free text address input has too much user friction and keying error risk so i wanted something like the auto look up but with greater reliability

For the UK the best way imo to get accurate postal addresses is using a licensed Royal Mail PAF provider. There are lots of providers and it’s personal choice but i found Ideal Postcodes the easiest to set up for me at the time of posting this. I used a Postcode look up which i explain below and show some code, this is partly because an address autocomplete looked beyond my skillset.

Here’s the set up and code, I hope it helps:

STEP 0: Wix site set up with developer mode enabled and a members area set up

STEP 1: Set up a trial account and get an API key from Ideal PostCodes. UK Address Verification - Ideal Postcodes (ideal-postcodes.co.uk)

STEP 2: Page Elements

Attached to a website Form where you want to capture the postal address info include each of:

  1. A short answer basic input field [#input18 in the front end code below]
    · This form field should not be saved to any submission data. Prompt text something like “add your postcode here”
    2. A button [#button21 in the front end code below]. Label “Find address” or similar
  2. A drop down selector [#dropdown5 in the front end code below]
    · This form field should be saved to Address submission in the members area. All default choices should be cleared from the dropdown box element in the page editor so that there are no available choices

STEP 3: Backend code (new jsw file called P_Postcode.jsw)

import { fetch } from ‘wix-fetch’ ;
export async function FindPostCode ( postcode ) {

let baseUrl = “https://api.ideal-postcodes.co.uk/v1/postcodes/

let url = baseUrl + postcode
const headers = { “Authorization” : ‘api_key=“yourkeyvalue”’ } //you could/should use API secrets manager but this particular site provider has some additional features which I understand make this ok

const response = await fetch ( url ,
{ method : “get” ,
headers : headers ,
})

const AddressResults = await response . json ()

const AddressResultsData = AddressResults . result
return AddressResultsData

STEP 4: Front end code

import { FindPostCode } from ‘backend/P_Postcode’ ;

export async function button21_click ( event ) {
let list = await FindPostCode ()
let n = list . length
for ( let i = 0 ; i < n - 1 ; i ++) {

let label = list [ i ]. line_1 + " , " + list [ i ]. postcode
let value = list [ i ]. line_1 + " , " + list [ i ]. line_2 + " , " + list [ i ]. line_3 + " , " + list [ i ]. post_town + " , " + list [ i ]. postcode

let  opts  =  $w ( "#dropdown5" ). options ; 

opts . push ({ “label” : ${ value }, “value” : ${ value }});
$w ( “#dropdown5” ). options = opts ;}
}

Sorry corrected front end code with the postcode being sent from the #input18

export async function button21_click ( event ) {

**let**  postcode  =  $w ( '#input18' ). value 
**let**  list  =  **await**  FindPostCode ( postcode ) 
//console.log(list) 
**let**  n  =  list . length 

// need to exception handle for n = 0 / no return from FindPostCode

//need to build the right extraction mechanic here or in the backend
for ( let i = 0 ; i < n - 1 ; i ++) {

//this doesn’t work it does not recognise “line_1”
let label = list [ i ]. line_1 + " , " + list [ i ]. postcode
let value = list [ i ]. line_1 + " ," + list [ i ]. line_2 + " , " + list [ i ]. line_3 + " , " + list [ i ]. post_town + " , " + list [ i ]. postcode

**let**  opts  =  $w ( "#dropdown5" ). options ; 

opts . push ({ “label” : ${ value }, “value” : ${ value }});
$w ( “#dropdown5” ). options = opts ;}

}