HTML表单自动完成地址语义

时间:2017-04-14 13:22:40

标签: html5 autofill vcard hcard

我正在处理一份注册表,在提交时需要提供家庭和工作地址。 字段如下:

<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 个答案:

答案 0 :(得分:2)

我假设您要使用完整street-address。如果您只想使用地址行1,请尝试address-line1

请参阅MDN Specification here

另外Google Developers page(注意:在此示例中,您可以看到locality, ...但不推荐使用它们。使用)

相关问题