Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yeah. But also, are you ready to maintain a postcode to city mapping for every country you have a significant userbase in?


I'm definitely not, but the lazy method is just to cache the data your customers provide, or curate some data for the countries you are most interested in.

That gets around countries that consider their postal code database a licensed dataset.


That’s a clever way of doing it, yeah.

From UI side, I’d probably not autofill, but add autocomplete (e.g. using <datalist>¹). This way you can still have browser autofill the user’s address if saved (do also set the autocomplete² props correctly!), and suggest one or multiple variants you have in your database, and let the user fill it out manually still, without having to find and click “My address isn’t here”.

¹<datalist>: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...

(quick note re: compat; Firefox does support it for the text fields, check the table at the bottom)

²autocomplete: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: