New Zealand address autocomplete

I’m trying to set up an app for a NZ based company. When using address autocomplete, either with default HERE map or with Google Maps, one of the critical address components gets lost. To explain:

In NZ the standard address format is Street Name & No, Suburb, Town, Country.
For example: 123 Taradale Road, Onekawa, Napier, New Zealand.

This is exactly what will show up in Knack’s Autocomplete if you type “123 Tara”.

But select it in autocomplete and what gets saved into the Knack address is:
123 Taradale Road,
Napier, Hawkes Bay, New Zealand

The “Onekawa” part (the suburb) is lost, but the province (Hawkes Bay, that no-one really cares about) is saved instead. So the saved address is effectively useless as it doesn’t provide the specifics required to be valid.

Does ANYONE know of a way to capture the Suburb in this case? Without it, autocomplete is effectively useless for New Zealand. I’ve logged a ticket (1932474530) but had no response as yet, so hoping someone in the community might know the trick to making this work.

Hi, Leigh!

Thank you for sharing here! We apologize for the delay, but thank you for sharing your ticket number.
Someone from our support team will be responding to your ticket shortly!

We’d like to know the answer to this too as we also have to manually add the suburb and delete the province.

The answer from Knack was sorry but no, we don’t support it. Disappointing but unsurprising.

@Dean2, you could use a record rule to delete the province field (its called STATE in the record) as the record is saved, and you can use CSS to hide the province in the data entry form. Something like below, depending on how you set up the field. You will also have to delete the field label in the form.

.kn-input-address .address-international #state {display: none; }
.kn-input-address .address-us #state {display: none; }

But I don’t have a solution for capturing the suburb info. Will investigate some javascript to strip it out of the string and save it as Street Address 2. If I succeed I’ll post the code here, but given my crappy performance as a coder i wouldnt hold your breath! :slight_smile:

1 Like

@Dean2 Apologies, my above suggestion is wrong - you cant use a record rule to just strip out a field of Address, as record rules don’t allow that level of granularity (just tried it). So it looks like a JavaScript solution for removal of the province as well.

Expanding on what @LeighBerre96926 shared, we’ve already circulated some sample addresses exhibiting this issue among our team. This ensures that everyone is aware of the problem. With it now on their radar, I’ll continue to keep you all posted on any further developments regarding this matter here in this thread. Thanks again for your contribution here in the forum! :slight_smile:

Thank you for that code. I’m no coder either, sorry.

We think it might be the KTL code we use that remembers our suburb inputs so that’s quicker than having to enter all the details but having to enter none would be the ideal outcome.

Now have a javascript workaround that puts the Suburb component into Street Address 2 field (I didn’t write it, Sunny Singla did). Will PM you @Dean2 with details. But @Les please have Knack continue to look at how to make their product more “international friendly” by handling such use cases natively.

1 Like

Folks, if anyone else is looking for something similar I now have javascript code that does this, and more, thanks to the genius of Sunny Singlia. As I funded this development work (which is only reasonable) I’d be looking for a meagre contribution from anyone who would like to benefit from it, and maybe one day I might recoup some of the cost. In the meantime, it has solved a problem.

What the code does (with no required CSS or changes to any page or table):

  1. Saves the suburb field into #Street2 so its visible and usable
  2. Changes all the address screen labels so they match the nomenclature in NZ (or whatever country)
  3. Limits address search to only New Zealand addresses. Note this will work for ANY single country.
  4. Removes the NZ province from the saved address as it really isn’t useful information.

PM me if you would like more info.