HTML の autocomplete 属性

この翻訳は不完全です。英語から この記事を翻訳 してください。

HTML の autocomplete 属性は、入力値としてテキストまたは数値を取るいくつかの種類の <input> 要素で利用できます。 autocomplete を使用すると、ウェブ開発者は入力欄にどの種類の情報が期待されているかをブラウザーに示唆するのと同様に、ユーザーエージェントがフォーム入力欄の値を埋めるための自動支援を提供する必要があることを指定します。

提案値の元は、一般にブラウザーに依存します。ふつうは、ユーザーが入力した過去の値からとりますが、あらかじめ構成された値から取得することもあります。例えば、ブラウザーはユーザーに名前、住所、電話番号、メールアドレスを自動補完するために保存させることができます。おそらく、ブラウザーは以降の認証手続で自動補完を行うために、クレジットカード情報を暗号化して保存する機能を提供しているでしょう。

<input> 要素に autocomplete 属性がない場合、ブラウザーはその要素のフォームオーナー、つまり <input> 要素を子孫に持つ <form> 要素、または <form> 要素で id<input> 要素の form 属性で指定されているものの autocomplete 属性の値を使用します。

詳しくは、 <form> 要素の autocomplete 属性をご覧ください。

"off"
ブラウザーはこのフィールドの値の自動的な入力または選択を許可されていません。文書やアプリケーションが独自の自動補完機能を提供していたり、セキュリティ上の理由でフィールドの値を自動的に入力しないよう要求していたりする可能性があります。
メモ: ほとんどの現行ブラウザーでは autocomplete 属性を "off" に設定しても、ブラウザーのパスワードマネージャーがユーザー名やパスワードを保存したいかをユーザーに問い合わせたり、ログインフォームにそれらを自動入力したりすることを抑制できません。autocomplete 属性とログインフィールドをご覧ください。
"on"
The browser is allowed to automatically complete the input. No guidance is provided as to the type of data expected in the field, so the browser may use its own judgement.
"name"
The field expects the value to be a person's full name. Using "name" rather than breaking the name down into its components is generally preferred because it avoids dealing with the wide diversity of human names and how they are structured; however, you can use the following autocomplete values if you do need to break the name down into its components:
"honorific-prefix"
接頭辞や敬称 (例: "Mr.", "Ms.", "Dr.", "Mlle")
"given-name"
名(ファーストネーム)
"additional-name"
ミドルネーム
"family-name"
苗字(ファミリーネーム、ラストネーム)
"honorific-suffix"
接尾辞 (例: "Jr.", "B.Sc.", "MBASW", "II")
"nickname"
A nickname or handle.
"email"
An email address.
"username"
A username or account name.
"new-password"
A new password. When creating a new account or changing passwords, this is the "Enter your new password" field, as opposed to any "Enter your current password" field that might be present. This may be used by the browser both to avoid accidentally filling in an existing password and to offer assistance in creating a secure password.
"current-password"
The user's current password.
"organization-title"
肩書 (例: "ソフトウェア技術者", "上級副社長", "副専務理事")
"organization"
A company or organization name, such as "Acme Widget Company" or "Girl Scouts of America".
"street-address"
A street address. This can be multiple lines of text, and should fully identify the location of the address within its second administrative level (typically a city or town), but should not include the city name, ZIP or postal code, or country name.
"address-line1", "address-line2", "address-line3"
Each individual line of the street address. These should only be present if the "street-address" is also present.
"address-level4"
The finest-grained administrative level, in addresses which have four levels.
"address-level3"
The third administrative level, in addresses with at least three administrative levels.
"address-level2"
The second administrative level, in addresses with at least two of them. In countries with two administrative levels, this would typically be the city, town, village, or other locality in which the address is located.
"address-level1"
The first administrative level in the address. This is typically the province in which the address is located. In the United States, this would be the state. In Switzerland, the canton. In the United Kingdom, the post town.
"country"
A country code.
"country-name"
A country name.
"postal-code"
A postal code (in the United States, this is the ZIP code).
"cc-name"
クレジットカードのような支払手段における姓名。Using a full name field is preferred, typically, over breaking the name into pieces.
"cc-given-name"
A given (first) name as given on a payment instrument like a credit card.
"cc-additional-name"
A middle name as given on a payment instrument or credit card.
"cc-family-name"
A family name, as given on a credit card.
"cc-number"
口座番号やクレジットカード番号などの支払手段を識別する番号。
"cc-exp"
支払手段の有効期限, typically in the form "MM/YY" or "MM/YYYY".
"cc-exp-month"
The month in which the payment method expires.
"cc-exp-year"
The year in which the payment method expires.
"cc-csc"
支払手段のセキュリティコード; on credit cards, this is the 3-digit verification number on the back of the card.
"cc-type"
支払手段の種類 (例: "Visa" or "Master Card").
"transaction-currency"
The currency in which the transaction is to take place.
"transaction-amount"
The amount, given in the currency specified by "transaction-currency", of the transaction, for a payment form.
"language"
優先言語。有効な BCP 47 言語タグ であること。
"bday"
誕生日, as a full date.
"bday-day"
The day of the month of a birth date.
"bday-month"
The month of the year of a birth date.
"bday-year"
The year of a birth date.
"sex"
性別 (例: Female, Fa'afafine)。自由形式の文字列であり、改行は不可。
"tel"
国番号を含む、完全な電話番号。If you need to break the phone number up into its components, you can use these values for those fields:
"tel-country-code"
The country code, such as "1" for the United States, Canada, and other areas in North America and parts of the Caribbean.
"tel-national"
The entire phone number without the country code component, including a country-internal prefix. For the phone number "1-855-555-6502", this field's value would be "855-555-6502".
"tel-area-code"
The area code, with any country-internal prefix applied if appropriate.
"tel-local"
The phone number without the country or area code. This can be split further into two parts, for phone numbers which have an exchange number and then a number within the exchange. For the phone number "555-6502", use "tel-local-prefix" for "555" and "tel-local-suffix" for "6502".
"tel-extension"
A telephone extension code within the phone number, such as a room or suite number in a hotel or an office extension in a company.
"impp"
A URL for an instant messaging protocol endpoint, such as "xmpp:username@example.net".
"url"
A URL, such as a home page or company web site address as appropriate given the context of the other fields in the form.
"photo"
The URL of an image representing the person, company, or contact information given in the other fields in the form.

詳しくは WHATWG 仕様書 をご覧ください。

Note: Firefox は他のブラウザーと異なり、 autocomplete 属性で、ページを再読み込みしても <input>動的に無効化した状態や (該当する場合は) 動的に変更したチェック状態を維持するか を制御します。この維持機能は、既定で有効です。 autocomplete 属性の値に off を設定すると、この機能を無効化できます。またこの設定は、type 属性が通常 autocomplete を適用しない値である <input> 要素でも有効です。 バグ 654072 をご覧ください。

Administrative levels in addresses

The four administrative level fields ("address-level1" through "address-level4") describe the address in terms of increasing levels of precision within the country in which the address is located. Each country has its own system of administrative levels, and may arrange the levels in different orders when addresses are written.

"address-level1" always represents the broadest administrative division; it is the least-specific portion of the address short of the country name.

Form layout flexibility

Given that different countries write their address in different ways, with each field in different places within the address, and even different sets and numbers of fields entirely, it can be helpful if, when possible, your site is able to switch to the layout expected by your users when presenting an address entry form, given the country the address is located within.

Variations

The way each administrative level is used will vary from country to country. Below are some examples; this is not meant to be an exhaustive list.

United States

A typical home address within the United States looks like this:

432 Anywhere St
Exampleville CA 95555

In the United States, the least-specific portion of the address is the state, in this case "CA" (the official US Postal Service shorthand for "California"). Thus "address-level1" is the state, or "CA" in this case.

The second-least specific portion of the address is the city or town name, so "address-level2" is "Exampleville" in this example address.

United States addresses do not use levels 3 and up.

United Kingdom

The UK uses one or two address levels, depending on the address. These are the post town and, in some instances, the locality.

China

China can use as many as three administrative levels: the province, the city, and the district.

ドキュメントのタグと貢献者

このページの貢献者: mfuji09, woodmix
最終更新者: mfuji09,