Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Autocomplete off" not working in IE - ASP.Net

Question: Is there any reason Autocomplete=off on a ASP:Textbox would not be working in IE 7?

In case this is the best term for it, the IE Autocomplete feature is that drop down list like thing that drops down from textboxes and shows you past things you have typed in.

I need the IE Autocomplete feature to not work at this point for a textbox that is part of a user control that works like an Ajax Autocomplete control. Problem is, when the Ajax Autocomplete selection list shows up, so does the IE Autocomplete selection box. (In cases where I might double click the textbox) I'm using this:

someTextbox.AutoCompleteType = AutoCompleteType.Disabled;

But it stills shows up. I've tried removing the items from the IE Autocomplete, but the next time I type something in and press enter, the problem reappears. Any ideas?

Note: The textbox is rendered with the Autocomplete=off tag when viewing the source.

Note 2: Have tried someTextbox.Attributes.Add("autocomplete", "off"); also without success

* Update, figured it out a while ago but forgot *

test.AutoCompleteType = AutoCompleteType.None;

That actually works. I'm not sure what the difference is though. Suppose Ill look that up sometime.

like image 469
Programmin Tool Avatar asked Oct 27 '08 19:10

Programmin Tool


People also ask

Why do browsers ignore autocomplete off?

This is because with HTML, this attribute (like any other), is a suggestion to the browser. To make things a little more complicated, browsers may also autofill form fields based on the field's name or id attributes. This is how browsers did it before the autocomplete attribute came along.

Do browsers respect autocomplete off?

Chrome respects autocomplete=off only when there is at least one other input element in the form with any other autocomplete value. This will not work with password fields--those are handled very differently in Chrome.


2 Answers

Try adding AUTOCOMPLETE="off" to your form tag too:

<form name="form1" id="form1" method="post" autocomplete="off">
like image 146
Lea Cohen Avatar answered Nov 15 '22 07:11

Lea Cohen


Trying to clear out my unanswered questions that I've answered in the original post.

test.AutoCompleteType = AutoCompleteType.None;
like image 32
Programmin Tool Avatar answered Nov 15 '22 09:11

Programmin Tool