views:

196

answers:

3

Hi

In my HTML FORMs, when I focus certain text fields they list down history of values entered previously. Is it possible to avoid this auto-drop-down? I am not looking for some browser settings tips for my computer, instead, I want these settings for all of the users of my website filling a form.

Will it also be possible to apply these settings for some selected text fields only? as historical values for some text fields may be helpful for a particular user using his/her machine.

May be this could be achieved using Javascript, but no clue where to start from.

Thanks for your help.

PS: I am using PHP and Javascript (JQuery).

+8  A: 

Add the attribute autocomplete="off" to each of your form elements.

This is not part of the W3C HTML standard, but it does work in both Mozilla & IE browsers.

Matt Bridges
I think this is an Internet Explorer specific thing.
mgroves
In which standard is this defined? In which browser is this implemented?
bandi
It is not defined in any standard, but I haven't seen a browser that does autocomplete that does *not* obey this tag.
Matt Bridges
will it pass thru validation tests?
Wbdvlpr
accessibility validation, and html validation
Wbdvlpr
Invented by Microsoft, but now in HTML5 (http://www.w3.org/TR/html5/forms.html#the-autocomplete-attribute) and supported by all major browsers: http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(HTML_5)
mercator
+2  A: 

Try autocomplete="off" in your <form> or <input> tag, see this Mozilla article, this MSDN page and this Safari Reference page for more info. Looks like Safari has only documented the use of the attribute on individual <input> tags though.

See also the answers to the question How can I prevent Firefox’s Autocomplete?

Paul Dixon
A: 

I think that this is implemented in firefox using an internal table with field names and their history. You can try to generate a custom name for your fields (like "name-asdfg" instead of just "name"), which results in a form generation and processing overhead (you must strip the nonsense from the end of the name).

bandi