tags:

views:

2101

answers:

5

I'm developing a website. I'm using a single-page web-app style, so all of the different parts of the site are AJAX'd into index.php. When a user logs in and tells Firefox to remember his username and password, all input boxes on the site get auto-filled with that username and password. This is a problem on the form to change a password. How can i prevent Firefox from automatically filling out these fields? I already tried giving them different names and ids.

Edit: Someone has already asked this. Thanks Joel Coohorn.

+1  A: 

Have you tried adding the autocomplete="off" attribute in the input tag? Not sure if it'll work, but it is worth a try.

Rob Rolnick
+15  A: 

From Mozilla's documentation

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

http://developer.mozilla.org/en/How_to_Turn_Off_Form_Autocompletion

Ryan Lanciaux
works like a charm.
tharkun
A: 

Dupe Question.

Joel Coehoorn
A: 

are all your input boxes set to type=password? That would do it. One of the things you can do, and I'm not at all sure that this is the best answer is to leave input box as an input type and just use javascript and onkeydown event to place stars in the input box instead of having the browser render it. Firefox won't pre-fill that.

As an aside, I have had to work on single-page web-apps and I absolutely hate it. Why would you want to take away the user's ability to bookmark pages? To use the back button?

George Mauer
I agree about the bookmarking and back button, but it's not my choice :(
Christian Oudard