1

I have this password change form on my settings page. Now some browsers have built-in functionality that detects this form with which I got issues. On loading settings page Firefox shows old password field already filled that obviously is current password of user logged in and chrome shows old password field empty but as user types in old password chrome asks user password for: john (chrome's auto fill) that is password for any user saved in chrome. I want to disable these functionalities in my script(not in browser). Is that possible ? autocomplete=off didn't help.

<label>Old Password</label> <input type="password" name="oldpassword" id="oldpassword" placeholder="Old password">
<label>New Password</label> <input type="password" name="newpassword" id="newpassword" placeholder="New password">
<label>Confirm Password</label> <input type="password" name="newpassword2" id="newpassword2" placeholder="Confirm new password">
bɪˈɡɪnə
  • 1,057
  • 1
  • 18
  • 44

2 Answers2

2

Chrome only autocompletes the first <input type="password"> and the previous <input>. So I added:

<input style="display:none">
<input type="password" style="display:none">

to the top of the <form> and the case was resolved.

From This post

Community
  • 1
  • 1
Divyesh Savaliya
  • 2,453
  • 2
  • 13
  • 31
  • Since recently, "display: none" trick doesn't work properly in Chrome. I had to make the fake input visible and use "width:1px; height:1px;" instead. – Sergey Vidusov Feb 16 '16 at 06:35
0

You use this:

<input type="password" name="foo" autocomplete="off" />

But it will not work in old browsers. Its mostly supported by firefox 30+ version browsers.

Source: Mozilla developer documentation

Vivek Sancheti
  • 325
  • 1
  • 3
  • 16