Salah ED
Salah ED

Reputation: 635

How to disable autofill for antd input with react

Hello i tried to create a new form to add new user, this form contain an input 'username' & another one 'password', my probleme is when i open the form the field username and password get by default the user and password saved in browser , i tried to user autoComplete='false' but it doesn't work.

My question is how to disable this feature, any hint can be helpfull

This is how it looks this is how it looks

Upvotes: 2

Views: 9058

Answers (3)

Raidel Torres
Raidel Torres

Reputation: 1

I know this is an old question, but I was facing the same dilemma and I just used a walkaround that feels like the easier thing to do. So will leave it here in case some one else wants a quick solution to this issue.

Just use inital or default values

<Form
...
initialValues={{ email: '', password: '', <<any field>>: '' }}
...
>

Upvotes: 0

Salah ED
Salah ED

Reputation: 635

I fixed this problem by adding autoComplete="new-password" to the Input.Password

<Input.Password placeholder="Mot de Passe" autoComplete="new-password" />

Upvotes: 7

Md Rana Hossain
Md Rana Hossain

Reputation: 314

Some versions of the browsers ignore these attributes autoComplete.

please check this Ans of this problem

Upvotes: 1

Related Questions