Stop browser from "form filling" fields

Hi all,

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?

Thanks in advance.

Cheers,
Diego

On Feb 27, 2007, at 6:48 PM, Diego wrote:

Cheers,
Diego

Try adding
autocomplete=“off”
to the input. In Rails’ ruby, this would be
:autocomplete => :off

-Rob

Rob B. http://agileconsultingllc.com
[email protected]

Thank you Rob!

On Feb 28, 12:50 pm, Rob B. [email protected]

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.

RSL

in firefox you have to go into the preferences and turn the feature
off under the privacy tab.

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.

RSL

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.

Perhaps you need to think about the reason you want “valid” (X)HTML.
Where Our Standards Went Wrong – A List Apart

I don’t think that you’ll find a de jure standard, but this de facto
one works for me.

-Rob

Rob B. http://agileconsultingllc.com
[email protected]

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)

autocomplete = “off” is works well for ie, firefox 2(with enabled
privacy).
tested.

the “problem” of xhtml compliance ?
forget about this incompartibility, in this case this is only the way.

I agree with Russel about taking away the users’ choices, but for the
record, here’s a (untested) solution using javascript:

function blankFields()
{
document.myform.username.value = “”;
document.myform.password.value = “”;
}

Then you use .

-N

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. :wink:

RSL

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.

RSL

if you’re worried about XHTML validation failing, you can do dirty
tricks like:

Event.observe(window,‘load’,function(){
$$(‘input’).invoke(‘setAttribute’,‘autocomplete’,‘off’);
});

(tested this only in FF, YMMV).

best,
thomas

Am 02.03.2007 um 15:44 schrieb [email protected]:

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. :slight_smile:

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.: