HTML form autocomplete address semantics

G4Hu picture G4Hu · Apr 14, 2017 · Viewed 7.6k times · Source

I am working on a registration form that requires home and work addresses upon submitting. The fields are as follows:

<html>
  <form>
    <input name="street-address" autocomplete="home street-address" required />
    <input name="postal-code" autocomplete="home postal-code" required />
    <input name="locality" autocomplete="home locality" required /> <!-- or "home city" -->

    <input name="organization" autocomplete="organization" required />
    <!-- addressee or department withing the organization. optional field -->
    <input name="addressee" autocomplete="????????" />
    <input name="work-street-address" autocomplete="work street-address" required />
    <input name="work-postal-code" autocomplete="work postal-code" required />
    <input name="work-locality" autocomplete="work locality" required />
  </form>
</html>

I am using http://microformats.org/wiki/hcard and https://html.spec.whatwg.org/multipage/forms.html#attr-fe-autocomplete-organization-title to create a nice browser compatible autofill form.

What I can't figure out is if there is a nice autofill name for the addressee / department field. Is anyone familiar with this / or any input?

Answer

Davit Yavryan picture Davit Yavryan · Aug 23, 2017

I assume you want to use full street-address. if you just want to use address line 1 then try address-line1.

See MDN Specification here

Also Google Developers page (Note: in this example you could see locality, ... but they are deprecated. use )