Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I stop autocomplete for individual fields

Status
Not open for further replies.

bmdev

Programmer
May 13, 2003
29
US
How can I stop some text fields on my web page from using the autocomplete feature? I notice some sites I go to they're blank and some are filled in so there must be some way to turn it off for some fields.

Thanks!!
 
I don't know about individual fields, but here's one way to do it for the entire form:
Code:
<form action="whatever" method="post" autocomplete="off">
And, as always...it probably depends on what browser you're using as to whether or not this works. I know it works in IE, but I don't think it does for others.



Hope This Helps!

Ecobb

&quot;My work is a game, a very serious game.&quot; - M.C. Escher
 
I don't think it's a matter of individually turning them off, but rather it's inherent to the way autocomplete works (as I understand it). IE is looking at the name of the form field and then pulls up a list of things you've previously entered for that same field name. E.g., "first" as the name for a first name field, or "firstname," etc. When the name of the field is different then it can't guess.

As such, you can choose non-obvious names if you don't want autocomplete to pull stuff from other sites ("field27" or "firstnameGLAVEN").

If you want to make sure it's never used for a particular field (but can be used for others) and you're generating pages dynamically, you can name the fields with a random bit on the end (that you strip off when processing the form), like "firstname-241505", with the number being randomly generated every time the page is served. Not perfect, but if the random bit is long enough it's quite unlikely that autocomplete will fire.

It's an idea, anyway. :)
 
Genimuse,

I did not know that is how the autocomplete function worked. Thanks for that explanation!

--Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top