pub enum Autocomplete {
Show 17 variants
On,
Off,
Name,
Email,
Username,
NewPassword,
CurrentPassword,
OneTimeCode,
Organization,
StreetAddress,
Country,
PostalCode,
CcNumber,
CcExp,
CcCsc,
Tel,
Url,
}Expand description
The autocomplete attribute values.
§Purpose
Controls browser autofill behavior for form fields, specifying what type of data the browser should suggest based on the user’s stored information.
§Usage Context
- Used with:
<input>,<textarea>,<select>,<form>elements - Privacy: Users control what data is stored for autofill
- UX: Improves form completion speed and accuracy
§Valid Values
On: Enable autofill with browser’s default heuristicsOff: Disable autofill for this fieldName: Full nameEmail: Email addressUsername: Username or account nameNewPassword: New password (e.g., registration, password change)CurrentPassword: Current password for loginOneTimeCode: One-time verification code (2FA, SMS)Organization: Organization or company nameStreetAddress: Full street addressCountry: Country or region codePostalCode: ZIP or postal codeCcNumber: Credit card numberCcExp: Credit card expiration dateCcCsc: Credit card security code (CVV/CVC)Tel: Telephone numberUrl: URL or website address
§Example
use ironhtml_attributes::{AttributeValue, Autocomplete};
let autocomplete = Autocomplete::Email;
assert_eq!(autocomplete.to_attr_value(), "email");<input type="email" autocomplete="email">
<input type="password" autocomplete="current-password">
<input type="text" autocomplete="name">
<input type="tel" autocomplete="tel">
<input type="text" autocomplete="street-address">
<input type="text" autocomplete="off">§WHATWG Specification
Variants§
On
Enable autofill with browser’s default behavior.
Off
Disable autofill for this field (sensitive data, unique IDs).
Name
Full name (combined given and family names).
Email address.
Username
Username or account identifier.
NewPassword
New password being set (registration or password change forms).
CurrentPassword
Current password for authentication (login forms).
OneTimeCode
One-time code for two-factor authentication (SMS, authenticator app).
Organization
Company or organization name.
StreetAddress
Full street address (may include multiple lines).
Country
Country or region name/code.
PostalCode
Postal code or ZIP code.
CcNumber
Credit card number.
CcExp
Credit card expiration date (month and year).
CcCsc
Credit card security code (CVV, CVC, CVV2).
Tel
Telephone number including country code.
Url
URL or website address.
Trait Implementations§
Source§impl AttributeValue for Autocomplete
impl AttributeValue for Autocomplete
Source§fn to_attr_value(&self) -> Cow<'static, str>
fn to_attr_value(&self) -> Cow<'static, str>
Source§impl Clone for Autocomplete
impl Clone for Autocomplete
Source§fn clone(&self) -> Autocomplete
fn clone(&self) -> Autocomplete
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more