# Bad value “new-password” for attribute “autocomplete” on element “input”: The autofill field name “new-password” is not allowed in this context.

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

The `autocomplete="new-password"` value can only be used on `<input>` elements whose type accepts password input, specifically `type="password"`.

The `autocomplete` attribute helps browsers autofill form fields. However, certain autofill tokens are restricted to specific input types. The `new-password` token tells the browser to suggest a new, generated password — which only makes sense on a password field. If you use it on a `type="text"`, `type="email"`, or other non-password input, the validator will flag it as invalid.

The same restriction applies to `current-password`. Both tokens are exclusively valid on `<input type="password">`.

## Invalid Example

```html
<label for="pass">Create a password</label>
<input type="text" id="pass" autocomplete="new-password">
```

## Valid Example

```html
<label for="pass">Create a password</label>
<input type="password" id="pass" autocomplete="new-password">
```

If your field is not meant to collect a password, use a different `autocomplete` value appropriate for the input type, such as `username`, `email`, or `off`.
