Scoots Scoots - 7 months ago 22
HTML Question

Autocomplete interfering with user creation form

I'm having a bit of an issue with autocomplete and wondering if anyone has found a way around this. Since browsers have started ignoring the autocomplete="off" attribute, I'm having a spot of bother with autocomplete in my admin area for creating new users filling in the login credentials that I've logged in with.

I've tried MDN's suggested hack autocomplete="none", I've tried randomising form input names, I've even tried using JavaScript to change a text field to a password field (with varying timeouts) - but every time the mere presence of a password field causes the browser to immediatley autofill the password. If there's a text field above the password field, that'll get autofilled too.

I'm fine with it being out of my hands on the login form, if anything it encourages users to have more secure passwords, but in the admin area I think it's a bit unfriendly for the user and really would like to disable or workaround it without changing the password field to a text field.

Note: The browser I was using was Firefox 51.0.1

Answer Source

I perhaps should have posted this a while ago, but hey, better late than never.

There is a work-around for this by simply including the following 2 elements at the top of them form:

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

These elements get autocompleted with the username, leaving my password/confirm password fields - and the preveeding text field - blank.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download