是否有 HTML 表单字段的命名约定,以便在所有现代浏览器中自动完成? [英] Is there a naming convention for HTML form fields for good auto completion across all modern browsers?

查看:73
本文介绍了是否有 HTML 表单字段的命名约定,以便在所有现代浏览器中自动完成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

表单域有命名约定吗?Chrome、IE、Firefox 寻找哪些领域?我的意思是,一应俱全,或者至少是大多数现代浏览器.

Is there a naming convention for form fields? For what fields do Chrome, IE, Firefox look for? I mean, one for all, or at least most of the modern browsers.

我偶然发现:

  • http://wonderfullyflawed.com/2009/02/17/rails-forms-microformat
  • http://acidmartin.wordpress.com/2008/10/28/using-ecml-11-to-make-website-forms-compatible-with-google-toobar-autofill-and-wand/ -> talking about http://www.ietf.org/rfc/rfc3106.txt
  • Names of HTML form naming conventions
  • Form field names used by personal data auto-fill in browsers (Safari, Opera)

例如ECML 方法使用这样的名称:

e.g. the ECML approach uses such names:

Description               Field name
----------------------------------------------------------
ship to title             Ecom_ShipTo_Postal_Name_Prefix
ship to first name        Ecom_ShipTo_Postal_Name_First
ship to middle name       Ecom_ShipTo_Postal_Name_Middle
ship to last name         Ecom_ShipTo_Postal_Name_Last

user ID                   Ecom_User_ID
user password             Ecom_User_Password

但是那些Ecom_..."表单字段对我来说似乎很奇怪?

But those "Ecom_..." form fields appear odd to me?

我知道仅 IE 和专有(当然)属性 VCARD_NAME="vCard.xyz",但它是无效的 html 属性.

I know about the IE-only and proprietary (of course) attribute VCARD_NAME="vCard.xyz", but it's an invalid html attribute.

或者是最好的镜头,以最常见的方式写字段,比如@F.B. 建议在 个人数据使用的表单字段名称在浏览器(Safari、Opera)中自动填充

Or is the best shot, to write the fields in the most common way like @F. B. suggests at Form field names used by personal data auto-fill in browsers (Safari, Opera)

小更新 (2015-07-21) - 偶然发现这个 Google 开发者博客帖子,其中提到了自动填充的 WHATWG HTML 规范:

Small Update (2015-07-21) - just stumbled upon this Google Developer Blog post which mentions the WHATWG HTML specs for Autofill:

https://html.spec.whatwg.org/multipage/forms.html#autofill

推荐答案

您似乎已链接到答案.但是,如果您不使用 CakePHP 或 Ruby on Rails 等高级框架,则第一个和第三个链接不适用.

You seem to have linked to the answers. If you are not using high-level frameworks like CakePHP or Ruby on Rails, though, the first and third links do not apply.

问题是,成功填写表单是 Google 工具栏和 Wand 的工作.鉴于互联网的范围,工具栏必须有冗余.

The thing is, it's Google Toolbar and Wand's job to fill out forms successfully. Given the scope of the internet, the toolbar must have tons of redundancy.

因此,只要您保持表单字段语义命名,表单就应该自动填充.

Therefore, as long as you keep your form fields semanticly named, the form should autofill.

ECML 是电子商务建模语言.Ecom_ 仅代表电子商务.如果您需要销售商品,请使用该命名约定.

ECML is E-Commerce Modeling Language. Ecom_ simply stands for E-Commerce. If you need to sell stuff, use that naming convention.

这篇关于是否有 HTML 表单字段的命名约定,以便在所有现代浏览器中自动完成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆