I have a user login form which the browser keeps populating because of
its form fill feature. So when anyone goes to log in it shows the
previous login’s username and password. How can I stop the browser
from populating a text field?
Unfortunately, the autocomplete attribute is IE only and doesn’t belong
to
any (X)HTML standard. Therefore browsers like Opera and Firefox may or
may
not support it. Firefox, for the record, does not.
I have a user login form which the browser keeps populating because of
its form fill feature. So when anyone goes to log in it shows the
previous login’s username and password. How can I stop the browser
from populating a text field?
You do know you can turn this feature off in the browser, correct?
Just checking.
I spoke incorrectly. Sorta. I’ll stand by the fact that autocomplete is
an
invalid HTML attribute but apparently Firefox does support it.
However, it
needs to be on the form and not the input. Not that I’m endorsing using
invalid HTML. Ick. I’m still searching for a valid HTML solution but
wanted
to correct my error.
At least on Mac, Firefox 2.0.0.2 and Safari 2.0.4 both support this
on the element. I haven’t check recently, but I think I
first found this with respect to IE (6.0?) on Windows about a year ago.
I don’t think this should be done anyways, in the End it’s a Browser
side feature about which the User should decide weither to use it or
not.
If the user wants to stor his username & password fields, let him do
it.
If not, he will disable it (and it’s disabled by default // most
browsers ask weither to act that way or not)
I gotta agree with Thorsten. Not only are you taking away a user’s
choices
[as opposed to giving him more] but there’s the [and I can’t stress this
enough] invalid markup issue. That’s two reasons not to use this
feature.
While this works… It’s kinda the equivalent of changing your answers
on a
test after the teacher’s already graded it. Either ignore the restraints
of
validation or follow them but this is just pretending. [God, I hope that
doesn’t sound super-snotty.] I agree with Rob in his [way] previous
comment
to me about questioning your rationale for following standards but I do
always aim for valid markup. It just seems weird not to. To me. YMMV.
If validation is used as a tool for making sure the page structure
itself is sound (as opposed to following the standards for their own
sake), it can help-- some things you want to have just aren’t covered
by the standards, or don’t work because browsers don’t implement them
correctly.
So a mixture of having pages validate (and tools aware of XHTML
working nicely) and “injecting” workarounds for both of the
aforementioned issues is working out fine. For me.
The “autocomplete” attribuet is probably a bad example anyway, as
normally you always want this the way the user decides, except for
certain cases (for example if you implement server-side
autocompleting, and browsers interfere).
Alas, I don’t think there’s one single unified answer for how to deal
with this, it really depends on the circumstances, your “style” of
coding, etc.
Best,
Thomas
Am 03.03.2007 um 15:00 schrieb Russell N.:
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.