20

There's several section of our site where the user needs to enter some information, and Firefox's auto fill takes over when the page loads - mostly incorrectly!

For example, there's a "Fax Number" field that for some users Firefox keeps filling in with their email address. If they don't see this and they go to submit the form out validators complain to them that it isn't a valid number format.

This really has our sales guys worried because when they go to look at a customers page, they sometimes see it filled in with their own personal info.

Is there any way to prevent Firefox from doing this?

unwind
  • 364,555
  • 61
  • 449
  • 578
CBarr
  • 21,475
  • 18
  • 85
  • 119
  • 2
    This is a duplicate of: http://stackoverflow.com/questions/2530/how-do-you-disable-browser-autocomplete-on-web-form-field-input-tag – Brett Veenstra Dec 08 '09 at 17:57

7 Answers7

36

Add autocomplete="off" to your form tag, as documented in the Mozilla document How to Turn Off Form Autocompletion

<form name="form1" id="form1" method="post" autocomplete="off"
  action="http://www.example.com/form.cgi">
[...]
</form>

Do read the section on exceptions and workarounds though - the browser will ignore the autocomplete attribute if you have a Name or Address field in the form!

Paul Dixon
  • 277,937
  • 48
  • 303
  • 335
14

If you don't care about validation, you can use autocomplete="off"

BTW here's a great article from Mozilla themselves about autocompletion

Ólafur Waage
  • 64,767
  • 17
  • 135
  • 193
2

I ran into the same problem on Firefox with forms having a 'username' and 'password' field. In this case autocomplete="off" doesn't seem to work, as stated here: https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion (bottom of page).

The only way I found right know to have en empty fields when opening the page is to empty them in javascript. jQuery code example:

setTimeout(function(){
    $('input[name="username"],input[name="password"]').val("");
}, 0);

I know it's ugly (especially the setTimeout but I couldn't figure another way. Even putting this in $(window).load() doesn't seem to work.

Simon
  • 2,830
  • 2
  • 18
  • 20
2

Firefox usually autocompletes based on the field names, so it sounds to me like you might have some underlying confusion with what your fields are called.

andygeers
  • 6,597
  • 9
  • 45
  • 63
1

If autocomplete="off" in the form fails, try using autocomplete="off" in the input field directly and hit Ctrl + F5.

Josh Darnell
  • 10,721
  • 9
  • 35
  • 62
sumantakec
  • 11
  • 1
1

Try to use dynamic input names.

Sergey Galashyn
  • 6,880
  • 2
  • 17
  • 39
0

Actually, since a few weeks I've noticed Firefox started mixing autofill values, dropdownlists show entries even from different sites. They probably broke something in their recent builds. Now some personal entries can be seen by people just asking to check mails on your pc. Desire to block this feature is now very understandable.

User
  • 28,268
  • 17
  • 74
  • 107