3 ms·
Should be titled "Put the Zipcode and country first". Would be simple enough to have someone type the zip or postal code first, then move the countries that ar
by avidiax 8mo ago
Should be titled "Put the Zipcode and country first".
Would be simple enough to have someone type the zip or postal code first, then move the countries that are known to have that zip code to the top of the drop down (still in alphabetical order), and all the other countries below that (also in alphabetical order).
Leave all the fields editable, i.e. the postal code only suggests, ranks, or prepopulates.
Seems like that would handle all the edge cases, including those where a zip code doesn't refer to one and only one city, or where a zip code has changed or been added to a country.
- junofan 8mo agoZIP Code (tm) is claimed as a trademark by the US Postal Service. If you don’t have a ZIP Code, why would you put something in the ZIP Code field?
- rmunn 8mo agoBecause most websites won't have two separate fields for "ZIP code" and "postal code". Even if they knew that ZIP Code is a trademark (I didn't until you mentioned it), they would (wisely) know that putting in two fields would just confuse most people. So they put in one field. Many sites label it as "ZIP code / postal code", but some just label it as "ZIP code". But the intent is clear: put in the multi-digit string that identifies your address, whether your country calls it a ZIP code or a postal code.
- pstuart 8mo agoPut a postal code first. Include a field for the country that is autofilled via Geolocation API or geoip if that's unavailable.
- notpushkin 8mo agoPut country first. Postcode doesn’t make sense without one. Prepopulating one based on location is generally okay, but don’t assume it will always be the same. Or just don’t try to be too clever.
- notpushkin 8mo agoYeah. But also, are you ready to maintain a postcode to city mapping for every country you have a significant userbase in?
- avidiax 7mo agoI'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.
- notpushkin 7mo agoThat’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/Elements/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/Attributes/autocomplete#token_list_tokens https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...