Firefox remembers wrong details username

The problem

Firefox takes the field right before the password field to be your username, regardless of the name, id or autocomplete attributes.

The solution

Place your username field and password field next to each other.


Note: Turning off autocomplete tells Firefox to forget the form data, but if this is a registration form Firefox will still ask the user if the credentials should be saved (stored separately from regular form data).


Make sure the name attributes are different for each input.

It may be the case that the browser identifies the first input as username or some equivalent, if no better alternative can be recognised.

EDIT---

Hmm. Well now I'm firing blind, but here's a guess: Firefox might not save form values for hidden inputs, and look for a substitute instead.

Try this: on the second stage, feature the name input as a text input type, not a hidden input type, but hide it with css. Then things might work better.


I've witnessed this behavior in Chrome as well (and customers have reported it in IE), so it's not just a Firefox issue. Namely, as Nelu said, the text field that appears before the password field (that is, a field with name="password") is treated as the login name field, regardless of its name, etc. If there are other form fields that are not "text", they'll be ignored.

For us, the right solution seems to be to avoid giving a field the name of "password" if we don't want that automatic browser behavior to come into play.

I think this is an example of the browser being a wee bit too helpful.