Avoiding Autocomplete

A

Alex

Hi,

I am wondering how it can be achieved to turn off the autocomplete
feature for a certain field.

I have noticed that setting an "autocomplete" attribute for a text field
to "off" does that. However I saw other implementions achieving it
without this attribute. So I am wondering, is there a CSS way or a
naming convention or .......

Thanks,
Alex
 
M

Michael Wilcox

Alex said:
I am wondering how it can be achieved to turn off the autocomplete
feature for a certain field.

As you mentioned, the autocomplete attribute is an option, but it's
nonstandard and breaks your page in the validator. Also, it only works
in IE, not the other browsers in use.

Like others will say, autocomplete is a feature of the user's browser,
not a feature of your site. You, in a sense, do not have the right to
turn it off. A lot of users find it useful. Is there some reason you
want it off?

I am wondering out loud here, and perhaps someone can back me up: Does
autocomplete rely on the name of the field to suggest options? If so,
changing the name to something else might thwart autocomplete.
 
A

Alex

Michael said:
As you mentioned, the autocomplete attribute is an option, but it's
nonstandard and breaks your page in the validator. Also, it only works
in IE, not the other browsers in use.

I didnt try it yet with other browsers, but if this is true it isnt an
option anyway.
Like others will say, autocomplete is a feature of the user's browser,
not a feature of your site. You, in a sense, do not have the right to
turn it off. A lot of users find it useful. Is there some reason you
want it off?

Oh my, I almost expected that someone will eventually reply with such a
kind of message.

Beside the fact, that I actually have every right to do whatever I wish
on my site (of course, as long as I do not break any laws) I didnt ask
for advice whether or whether not I should do it, but HOW to do it.

I have a _specific_ reason why I _need_ to do this.
I am wondering out loud here, and perhaps someone can back me up: Does
autocomplete rely on the name of the field to suggest options? If so,
changing the name to something else might thwart autocomplete.

I am quite sure that the name attribute is one of the major factors in
determining the autocomplete data for a field, however unfortunately
setting a random name isnt an option in my case.

Alex
 
A

Alex

Michael said:
As you mentioned, the autocomplete attribute is an option, but it's
nonstandard and breaks your page in the validator. Also, it only works
in IE, not the other browsers in use.

I didnt try it yet with other browsers, but if this is true it isnt an
option anyway.
Is there some reason you want it off?

Yes, I do. The text field in question is used for sending messages and
hence it isnt really an acceptable thing to have the dropdown list
popping up each time upon entering a new message.
I am wondering out loud here, and perhaps someone can back me up: Does
autocomplete rely on the name of the field to suggest options? If so,
changing the name to something else might thwart autocomplete.

I am quite sure that the name attribute is one of the major factors in
determining the autocomplete data for a field, however unfortunately
setting a random name isnt an option in my case.

Alex
 
O

Oli Filth

Alex said:
Oh my, I almost expected that someone will eventually reply with such a
kind of message.

Beside the fact, that I actually have every right to do whatever I wish
on my site (of course, as long as I do not break any laws) I didnt ask
for advice whether or whether not I should do it, but HOW to do it.

Yes, but as was said, AutoComplete is a function of the user's browser,
not your site.
I have a _specific_ reason why I _need_ to do this.

Would you mind if I asked why, just out of curiosity? It seems quite a
strange think to _need_.
 
K

kchayka

Michael said:
it only works in IE, not the other browsers in use.

Not true. mozilla browsers have supported the autocomplete attribute for
a long time now, at the request of some financial institutions who
consider it a security feature.
 
A

Alex

Oli said:
Yes, but as was said, AutoComplete is a function of the user's browser,
not your site.

As any feature to disable it is.
Would you mind if I asked why, just out of curiosity? It seems quite a
strange think to _need_.

It is for a messaging application where such a constantly popping up
list isnt acceptable.

Alex
 
O

Oli Filth

Alex said:
It is for a messaging application where such a constantly popping up
list isnt acceptable.

Ah, in that case, a <TEXTAREA> might be appropriate. As far as I've
played around with it, a <TEXTAREA> doesn't have AutoComplete.
 
S

Steve Pugh

Alex said:
It is for a messaging application where such a constantly popping up
list isnt acceptable.

But for messages that are so short that a text input is more suitable
than a textarea (no autocomplete feature on textareas)?

I've used messaging apps where an autocomplete style feature was
included and I found it helpful. Often I am sending the same or very
similar messages again.

Steve
 
A

Alex

Oli said:
Ah, in that case, a <TEXTAREA> might be appropriate. As far as I've
played around with it, a <TEXTAREA> doesn't have AutoComplete.

True, but a text area gives me multiple lines and no reaction for ENTER.

Alex
 
O

Oli Filth

Alex said:
True, but a text area gives me multiple lines and no reaction for ENTER.

In that case, what's wrong with the random name attribute idea posted
somewhere else in this thread?
 
D

David Dorward

Alex said:
With a constantly changing name I couldnt reference the value anymore.

Use a consistant prefix then in your form handler get a list of all the
values and grep for the one which includes that prefix. Or include a hidden
field with the random name as its value.
 
A

Alex

Oli said:
In that case, what's wrong with the random name attribute idea posted
somewhere else in this thread?

With a constantly changing name I couldnt reference the value anymore.

Alex
 
A

Alex

Alex said:
Hi,

I am wondering how it can be achieved to turn off the autocomplete
feature for a certain field.

I have noticed that setting an "autocomplete" attribute for a text field
to "off" does that. However I saw other implementions achieving it
without this attribute. So I am wondering, is there a CSS way or a
naming convention or .......

Thanks,
Alex

So I guess this question belongs to the great miracles which nobody has
an answer for :(.

Alex
 
A

Alex

David said:
Use a consistant prefix then in your form handler get a list of all the
values and grep for the one which includes that prefix. Or include a hidden
field with the random name as its value.

Thanks David, those are both nice suggestions (especially the second
one), however they cannot really be applied in my case, as they would
only work if I could set the random after each request, which I cant.

Anyhow, as I mentioned there are implementions which have achieved that,
but unfortunately I was unable to determine how. Neither the HTML nor
the CSS did contain any possible reference to the AutoComplete feature.
For a while I thought it would have something to do with caching related
HTTP headers, but this wasnt the case either.

Alex
 
O

Oli Filth

Alex said:
With a constantly changing name I couldnt reference the value anymore.

Alex

If you include a hidden field in your form whose value is the random
name, then all will be fine.

e.g. in PHP:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HEAD>
<TITLE>Test</TITLE>
<BODY>
<?php
if (isset($_GET["name"]))
{
$name = $_GET["name"];

echo "<PRE>" . htmlspecialchars($_GET[$name]) . "</PRE>";
}

/* generate name */
$name = "";
for ($i = 0; $i < 10; $i++)
{
$name .= chr(rand(65, 90));
}
for ($i = 0; $i < 6; $i++)
{
$name .= chr(rand(48, 57));
}
?>
<FORM action="" method="get">
<P>
Type something<BR>
<INPUT type="hidden" name="name" value="<?php echo $name ?>">
<INPUT name="<?php echo $name ?>" type="text">
<INPUT type="submit" value="submit...">
</P>
</FORM>
</BODY>
</HTML>
 
A

Alex

Oli said:
If you include a hidden field in your form whose value is the random
name, then all will be fine.

Thank you Oli. This is similar to David's suggestion, however this would
require me to change the name after each request, which I cant because I
a not reloading the page continuously. Its a bit more difficult than
the typical request/reply scenario.

I guess there is only either the autocomplete attribute way or
completely analysing what the implementations do, which I mentioned.

Thanks anyhow,
Alex
 
O

Oli Filth

Alex said:
Thank you Oli. This is similar to David's suggestion, however this would
require me to change the name after each request, which I cant because I
a not reloading the page continuously. Its a bit more difficult than
the typical request/reply scenario.

So where is the browser going when the user clicks "submit" (or presses
Enter or whatever) on the form? How is it working if it's not sending a
request to some URL with the form contents and receiving a response...?
 
M

me

Alex said:
Hi,

I am wondering how it can be achieved to turn off the autocomplete
feature for a certain field.

I have noticed that setting an "autocomplete" attribute for a text field
to "off" does that. However I saw other implementions achieving it
without this attribute. So I am wondering, is there a CSS way or a
naming convention or .......

Thanks,
Alex

I posted the following in comp.infosystems.www.authoring.html, here it is
again in case you missed it. See below:
Good Luck,
me

Here:
http://64.233.167.104/search?q=cach...rg/script/1638.htm+autocomplete+disable&hl=en

I found this for IE:
<form name="myForm">
<input type="password" name="myField" autocomplete="off">
</form>

Also this for IE:
<script language="JavaScript"><!--
document.myForm.myField.setAttribute('autocomplete','on')
//--></script>

Here:
http://www.xulplanet.com/references...foxAutoComplete.html#attr_disableautocomplete

I found this for Fire Fox (don't know if it will work because I use IE):
disableautocomplete
Type: boolean
Set this attribute to true to disable autocomplete on the textbox. This
might be used to temporarily disable autocomplete for a field.

More here but less informative:
https://lists.latech.edu/pipermail/javascript/2001-June/000817.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top