SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Addict
    Join Date
    Oct 2008
    Posts
    263
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Input not to remember history

    Hello

    I remember i used to add a piece of code the HTML text input field so that no previous entries menu drops down anymore whenever you visit the page again and type in the same field.. can you please remind me what to be added to the input tag? many thanks...

  2. #2
    masquerading Nick's Avatar
    Join Date
    Jun 2003
    Location
    East Coast
    Posts
    2,215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you talking about value=""?

    Code:
    <input type="text" name="username" value="" />
    Nick . all that we see or seem, is but a dream within a dream
    Show someone you care, send them a virtual flower.
    Good deals on men's watches

  3. #3
    SitePoint Addict
    Join Date
    Oct 2008
    Posts
    263
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No i meant, i don't want the drop down menu to appear when you type in showing what was entered previously.. i don't want the remember list to appear...

  4. #4
    masquerading Nick's Avatar
    Join Date
    Jun 2003
    Location
    East Coast
    Posts
    2,215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Correct me if I am wrong, but I believe that is a browser controlled feature.
    Nick . all that we see or seem, is but a dream within a dream
    Show someone you care, send them a virtual flower.
    Good deals on men's watches

  5. #5
    SitePoint Addict
    Join Date
    Oct 2008
    Posts
    263
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mm i remember i used to make some input fields that do not display a drop down menu whenever you type in...

  6. #6
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's a non-standard attribute (can't remember the name) that works in some browsers, but overriding such built-in features is not a good idea. Especially not if it requires invalid markup.
    Birnam wood is come to Dunsinane

  7. #7
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,834
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    If you don't want the suggestions showing then disable that option in your browser.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  8. #8
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is a nonstandard attribute, autocomplete="off", that you can use to disable this. Your page won't validate if you use this. It only works because online banking sites pressured browser makers into supporting this attribute.

  9. #9
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess I won't surprise anyone to mention that autocomplete='' has been in HTML5 since 2004?
    Simon Pieters

  10. #10
    SitePoint Addict
    Join Date
    Oct 2008
    Posts
    263
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    autocomplete="off"
    This is it, thank you.

  11. #11
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,834
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by zcorpan View Post
    I guess I won't surprise anyone to mention that autocomplete='' has been in HTML5 since 2004?
    The real question is will it stillbe there in 2025 when that standard is finally adopted (if it ever is).
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  12. #12
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    The real question is will it stillbe there in 2025 when that standard is finally adopted (if it ever is).
    Do you have any reason to believe that browsers would drop support for it?
    Simon Pieters

  13. #13
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,834
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by zcorpan View Post
    Do you have any reason to believe that browsers would drop support for it?
    The move is toward giving the browser owner more control of how their browser works and so it is likely that browsers will soon offer an option to turn that off in the web page for those who want their browser to make the suggestions on what the field might contain. Just about every other option that web pages can ask to turn off can now be turned back on by the browser owner so leaving out that one is an anomaly that should soon be rectified.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  14. #14
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    The move is toward giving the browser owner more control of how their browser works and so it is likely that browsers will soon offer an option to turn that off
    Right... HTML5 allows this (last paragraph in http://www.whatwg.org/specs/web-apps...lete-attribute ).
    Simon Pieters

  15. #15
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Had a thought a few minutes ago about a more standards-compliant way of doing this.

    You could generate a random string using a server-side language of your choice and set that as the name attribute of the input field for which you don't want autocomplete to detect.

    You'll also need to set the same string as the value attribute of a hidden field which would also be passed to your form handling script.

    The script could then grab the value of the hidden field to get the name of the text field. Does this make sense?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •