Avoiding Autocomplete

Discussion in 'HTML' started by Alex, Mar 26, 2005.

  1. Alex

    Alex Guest

    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
     
    Alex, Mar 26, 2005
    #1
    1. Advertising

  2. Alex wrote:

    > 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.
    --
    Michael Wilcox
     
    Michael Wilcox, Mar 26, 2005
    #2
    1. Advertising

  3. Alex

    Alex Guest

    Michael Wilcox wrote:
    >
    > 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
     
    Alex, Mar 26, 2005
    #3
  4. Alex

    Alex Guest

    Michael Wilcox wrote:
    >
    > 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
     
    Alex, Mar 26, 2005
    #4
  5. Alex

    Oli Filth Guest

    Alex wrote:
    > Michael Wilcox wrote:
    >
    >> 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.
    >


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


    --
    Oli
     
    Oli Filth, Mar 26, 2005
    #5
  6. Alex

    kchayka Guest

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

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

    --
    Reply email address is a bottomless spam bucket.
    Please reply to the group so everyone can share.
     
    kchayka, Mar 26, 2005
    #6
  7. Alex

    Alex Guest

    Oli Filth wrote:
    >
    > 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
     
    Alex, Mar 26, 2005
    #7
  8. Alex

    Oli Filth Guest

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


    --
    Oli
     
    Oli Filth, Mar 26, 2005
    #8
  9. Alex

    Steve Pugh Guest

    Alex <> wrote:
    >Oli Filth wrote:
    >>
    >> 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.


    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

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
     
    Steve Pugh, Mar 26, 2005
    #9
  10. Alex

    Alex Guest

    Oli Filth wrote:
    >
    > 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
     
    Alex, Mar 26, 2005
    #10
  11. Alex

    Oli Filth Guest

    Alex wrote:
    > Oli Filth wrote:
    >
    >>
    >> 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.
    >


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


    --
    Oli
     
    Oli Filth, Mar 26, 2005
    #11
  12. Alex wrote:

    > Oli Filth wrote:
    >>
    >> 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.


    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.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Mar 28, 2005
    #12
  13. Alex

    Alex Guest

    Oli Filth wrote:
    >
    > 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
     
    Alex, Mar 28, 2005
    #13
  14. Alex

    Alex Guest

    Alex wrote:
    > 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
     
    Alex, Mar 28, 2005
    #14
  15. Alex

    Alex Guest

    David Dorward wrote:
    >
    > 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
     
    Alex, Mar 28, 2005
    #15
  16. On Mon, 28 Mar 2005 15:48:35 +0100, David Dorward <> wrote:

    > Alex wrote:
    >
    >> Oli Filth wrote:
    >>>


    Also see <VNV1e.14533$> for a new thread on this subject
    :)


    --
    ,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
    | weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
    | webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
    |zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
    `-------------------------------------------------- --<--@ ------------'
     
    Barbara de Zoete, Mar 28, 2005
    #16
  17. Alex

    Oli Filth Guest

    Alex wrote:
    > Oli Filth wrote:
    >
    >>
    >> 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


    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>


    --
    Oli
     
    Oli Filth, Mar 28, 2005
    #17
  18. Alex

    Alex Guest

    Oli Filth wrote:
    >
    > 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
     
    Alex, Mar 28, 2005
    #18
  19. Alex

    Oli Filth Guest

    Alex wrote:
    > Oli Filth wrote:
    >
    >>
    >> 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.


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

    --
    Oli
     
    Oli Filth, Mar 28, 2005
    #19
  20. Alex

    me Guest

    "Alex" <> wrote in message
    news:ZMe1e.12633$...
    > 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
     
    me, Mar 29, 2005
    #20
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike P

    autocomplete

    Mike P, Jun 25, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    953
    Natty Gur
    Jun 25, 2003
  2. Ali

    Set AutoComplete to Off

    Ali, Nov 18, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    440
  3. Lloyd Sheen

    Stopping AutoComplete

    Lloyd Sheen, Nov 21, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,225
    Saravana [MVP]
    Nov 21, 2003
  4. Grey
    Replies:
    5
    Views:
    17,481
    PeterBrunone
    Sep 6, 2006
  5. moondaddy
    Replies:
    7
    Views:
    570
    Jeffrey Tan[MSFT]
    Apr 8, 2004
Loading...

Share This Page