# Bad value “none” for attribute “autocomplete” on element “input”: The string “none” is not a valid autofill field name.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-none-for-attribute-autocomplete-on-element-input-the-string-none-is-not-a-valid-autofill-field-name
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `autocomplete` attribute tells the browser how to handle autofilling a form field. The HTML specification defines a strict set of allowed values: the keywords `on` and `off`, and a collection of autofill field names such as `name`, `email`, `username`, `new-password`, `street-address`, and many others. The value `"none"` is not part of this specification, even though it might seem like a logical choice for "no autocomplete."

This confusion likely arises because some non-web APIs and frameworks use `"none"` as a keyword to disable features. In HTML, however, the correct keyword to disable autocompletion is `"off"`. Using an invalid value like `"none"` leads to undefined browser behavior — some browsers may ignore it entirely and autofill anyway, while others might treat it as equivalent to `"on"`. This inconsistency can cause unexpected user experiences and potential security concerns, especially for sensitive fields like passwords or credit card numbers.

Beyond standards compliance, using valid `autocomplete` values improves accessibility. Assistive technologies and password managers rely on recognized autofill field names to help users fill out forms efficiently. When a valid, descriptive value like `"username"` or `"email"` is provided, browsers and assistive tools can offer more accurate suggestions.

## How to fix it

Replace `"none"` with the appropriate valid value:

- Use `"off"` if you want to disable autofill for the field.
- Use `"on"` if you want the browser to decide how to autofill the field.
- Use a specific autofill field name if you want to hint at the type of data expected.

Common autofill field names include: `name`, `given-name`, `family-name`, `email`, `username`, `new-password`, `current-password`, `tel`, `street-address`, `postal-code`, `country`, `cc-number`, `cc-exp`, and `cc-name`. You can also combine tokens, such as `"shipping postal-code"` or `"billing cc-number"`, to provide additional context through section and hint tokens.

> **Note:** Even with `autocomplete="off"`, some browsers may still autofill certain fields (particularly login credentials) for security or usability reasons. This is browser-specific behavior and not something the HTML specification can override.

## Examples

### Incorrect: using `"none"` to disable autofill

```html
<form>
  <label for="user">Username</label>
  <input type="text" id="user" name="username" autocomplete="none">
</form>
```

### Correct: using `"off"` to disable autofill

```html
<form>
  <label for="user">Username</label>
  <input type="text" id="user" name="username" autocomplete="off">
</form>
```

### Correct: using a specific autofill field name

When you know what kind of data a field collects, providing a descriptive autofill field name is often better than using `"on"` or `"off"`. This helps browsers offer accurate suggestions:

```html
<form>
  <label for="user">Username</label>
  <input type="text" id="user" name="username" autocomplete="username">

  <label for="email">Email</label>
  <input type="email" id="email" name="email" autocomplete="email">

  <label for="pwd">New Password</label>
  <input type="password" id="pwd" name="password" autocomplete="new-password">
</form>
```

### Correct: using section and hint tokens

You can prefix an autofill field name with a section name or shipping/billing hint to distinguish between multiple addresses in the same form:

```html
<form>
  <label for="ship-zip">Shipping postal code</label>
  <input type="text" id="ship-zip" name="ship_zip" autocomplete="shipping postal-code">

  <label for="bill-zip">Billing postal code</label>
  <input type="text" id="bill-zip" name="bill_zip" autocomplete="billing postal-code">
</form>
```
