Scott Hanselman

Turning off AutoComplete for TextBoxes in IE and FireFox

January 27, '05 Comments [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
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Thursday, January 27, 2005 1:28:49 AM UTC
Can you control that field by field?
Thursday, January 27, 2005 2:55:48 AM UTC
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.
Thursday, January 27, 2005 5:12:40 AM UTC
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.
Thursday, January 27, 2005 7:12:18 AM UTC
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.
Monday, January 31, 2005 5:17:04 PM UTC

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

joe
Comments are closed.

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