2017-04-14 63 views
2

我正在製作註冊表單,在提交時需要住宅和工作地址。 的字段說明如下:HTML表單自動完成地址語義

<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> 

我使用http://microformats.org/wiki/hcardhttps://html.spec.whatwg.org/multipage/forms.html#attr-fe-autocomplete-organization-title創造一個很好的瀏覽器兼容的自動填寫表單。

我無法弄清的是,如果收件人/部門字段有一個不錯的自動填充名稱。 是否有人熟悉這個/或任何輸入?

回答

1

我假設你想使用完整的street-address。如果您只想使用地址欄1,請嘗試address-line1

MDN Specification here

而且Google Developers page(注:在這個例子中,你可以看到locality, ...但他們不贊成使用。)