Scott Hanselman

Turning off AutoComplete for TextBoxes in IE and FireFox

January 27, 2005 Comment on this post [6] Posted in ASP.NET
Sponsored By

This is one a lot of people know, but it's worth covering again because it's easily forgotten as it's a small detail. Since we do eFinance sites, we often don't want folks' UserNames collected and stored in AutoComplete, especially when the site is browsed on a public machine.

<form id="formSignOn" autocomplete="off" method="post" runat="server">

Note that autocomplete="false" doesn't work. However, autocomplete="off" works in both IE and FireFox.

Thanks to Johnson Michael for reminding me of this tip.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
January 27, 2005 5:28
Can you control that field by field?
January 27, 2005 6:55
No, you cannot control it by field, only on the form.

Also, another note regarding Autocomplete. If you are using Visual Studio .NET version 2003 or earlier, it sometimes will add AUTOCOMPLETE="ON" when you are in design mode. I haven't tested this in Whidbey yet to see if this is fixed.
January 27, 2005 9:12
In Whidbey, FWIW, you can set a property named AutoCompleteType to specify that the TextBox either renders autocomplete="off", or that it gets its default value from a field in the vcard schema.
January 27, 2005 11:12
Mike, AutoCompleteType sets the VCard Attribute that IE uses to pull the data from the Profile assistant, but doesn't appear (with my build of Whidbey) to affect the Form's AutoComplete stuff. However, the FORM (runat=server) has it's own AutoComplete="on|off" attribute.
January 31, 2005 21:17

You can use it also in input boxes. (field by field)
March 07, 2006 0:15
A little detail on the whidbey: Autocomplete is not available. Autocompletetype=None does Not do it. You need Autocomletetype="disabled"


Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.