Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I prevent Firefox's Autocomplete?

Tags:

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?

like image 538
FiniteLooper Avatar asked Mar 25 '09 16:03

FiniteLooper


People also ask

How do I disable input field autocomplete?

Use the <input> tag with autocomplete attribute. Set the autocomplete attribute to value “off”.


2 Answers

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!

like image 179
Paul Dixon Avatar answered Oct 18 '22 13:10

Paul Dixon


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

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

like image 22
Ólafur Waage Avatar answered Oct 18 '22 13:10

Ólafur Waage