What is the point of the autocomplete attribute? Isn't it bad practice to tell your users how their browser should work to fill a form?
There are cases where you could conceivably want to force the user to manually enter data:
- A domain registrar might apply this to the domain field to ensure accuracy and avoid the auto-filling of previous attempts.
- If an application might be used in a fairly public setting like a shared kiosk, you might want to prevent a form from giving hints as to who's used it previously.
- The app provides its own auto-completion.
- E-mail/confirmation fields.
- The spec gives some other examples.
Isn't it bad practice to tell your users how their browser should work to fill a form? […] I was thinking about the whole "don't open links in new windows, let the user decide"
Don't confuse bad practice with judgement call, even if that call tends to lean heavily toward "Don't."
Yes, it's generally accepted that you shouldn't open links in new windows, but that was more a retaliation against a time when many sites would open nearly all links–or at least off-site ones–in new windows. As with most tools, even disliked ones, there are cases where it's useful and you need to decide if the technique applies to your situation.
w3schools site you linked:
"Tip: It is possible to have autocomplete "on" for the form, and "off" for specific input fields, or vice versa."
This could be so that only certain fields are autocompleted, rather than the browser attempting to fill in ALL of the fields. It would also only work if the browser has autocomplete enabled.
"Isn't it bad practice to tell your users how their tool should work to fill a form ?" Can you please clarify this? What is
Their tool ?