Disabling Auto-Complete For Certain Fields

Posted by Dan on Apr 12, 2004 @ 7:50 PM

Have you ever wanted to turn off Internet Explorer's "auto-complete" feature for a specific form field? Well, there's a lesser known, IE-specific, attribute named "autocomplete" for the <input> tag which will disable the auto-complete drop down box from appearing. Why would you want to do that, well there's lots of reasons. Maybe your creating a site geared towards public computers that allow a user logon; in that case, you don't want user names appearing in the autocomplete box.

To disable the auto-complete feature, just add the "autocomplete" attribute to your form field tags with the value of "off". For example:

<input type="text" name="userId" autocomplete="off" />

NOTE:
One thing to note, the only valid values for this tag are "on" and "off"—"true" and "false" are not valid values. My instinct is always to use true/false, which don't work.

Categories: Source Code, HTML/ColdFusion, Technology, JavaScript

Add Comment

Leave this field empty