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

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-nope-for-attribute-autocomplete-on-element-input-the-string-nope-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 autofill for a form field. The HTML specification defines a strict set of valid values, which include `"on"`, `"off"`, and a list of autofill field names such as `"username"`, `"new-password"`, `"cc-number"`, `"postal-code"`, and many others. When you use a value that isn't in this list — such as `"nope"`, `"false"`, `"none"`, or any other made-up string — the W3C validator reports it as an invalid autofill field name.

A common reason developers use values like `"nope"` is as a workaround because some browsers historically ignored `autocomplete="off"`. In older versions of Chrome and Firefox, the browser would still show autofill suggestions even when `off` was set, so developers discovered that using an unrecognized value like `"nope"` effectively tricked the browser into not showing suggestions. While this hack may have worked in practice, it produces invalid HTML and is not a reliable long-term solution since browser behavior around unrecognized values can change at any time.

### Why this matters

- **Standards compliance:** Invalid attribute values make your HTML non-conforming, which can cause issues with tooling, testing pipelines, and accessibility auditors.
- **Accessibility:** Screen readers and assistive technologies rely on valid `autocomplete` values to help users fill in forms. Using a correct autofill field name like `"given-name"` or `"email"` can significantly improve the experience for users with disabilities. In fact, WCAG 2.1 Success Criterion 1.3.5 specifically recommends using valid autocomplete values for fields that collect user information.
- **Browser behavior:** Modern browsers have improved their handling of `autocomplete="off"`. Using the standard value is now more reliable than it once was, and using it correctly ensures predictable behavior across browsers.

### How to fix it

1. **To disable autocomplete**, replace the invalid value with `"off"`.
2. **To enable smart autofill**, use the appropriate autofill field name from the [HTML specification's list of autofill field names](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill). This is the preferred approach for most user-facing forms.
3. **For new passwords** (e.g., registration or password-change forms), use `"new-password"` — this tells the browser to suggest a generated password rather than filling in a saved one.

## Examples

### Invalid: made-up autocomplete value

```html
<input type="text" name="firstName" autocomplete="nope">
```

Other common invalid values that trigger the same error include `"false"`, `"none"`, `"disable"`, and `"no"`.

### Fixed: disabling autocomplete with `"off"`

```html
<input type="text" name="firstName" autocomplete="off">
```

### Fixed: using a valid autofill field name

Using a specific autofill field name is often better than `"off"` because it helps browsers and assistive technologies understand the purpose of the field:

```html
<input type="text" name="firstName" autocomplete="given-name">
```

### Fixed: common valid autocomplete values in a form

```html
<form method="post" action="/register">
  <label for="name">Full Name</label>
  <input type="text" id="name" name="name" autocomplete="name">

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

  <label for="newpass">Password</label>
  <input type="password" id="newpass" name="password" autocomplete="new-password">

  <label for="tel">Phone</label>
  <input type="tel" id="tel" name="phone" autocomplete="tel">

  <button type="submit">Register</button>
</form>
```

Some of the most commonly used valid values include: `"name"`, `"given-name"`, `"family-name"`, `"email"`, `"username"`, `"new-password"`, `"current-password"`, `"street-address"`, `"postal-code"`, `"country"`, `"tel"`, `"cc-number"`, and `"organization"`. Refer to the full list in the HTML specification for all available options.
