prevent dropdown with previous input

Discussion in 'Javascript' started by groups2@reenie.org, Jun 17, 2007.

  1. Guest

    When you press the down key while in an input field the default
    behavior for some event creates a dropdown of the previously input
    text.
    What event creates that behavior and how do I stop it ?

    For example, to prevent ANY type of default behavior when clicking ANY
    key, I thought this would work, but the dropdown still occurs. What am
    I doing wrong ?

    In html file:<body onload="registersearch()" >
    Search Text: <input type='text' id='searchtext' />

    in javascript file:
    function blank(){
    return false;
    }
    function registersearch(){

    document.getElementById("searchtext").onkeyup=blank;
    document.getElementById("searchtext").onkeypress=blank;
    document.getElementById("searchtext").onkeydown= blank;
    document.getElementById("searchtext").onclick=blank;

    }
    , Jun 17, 2007
    #1
    1. Advertising

  2. On Jun 17, 7:32 am, wrote:
    > When you press the down key while in an input field the default
    > behavior for some event creates a dropdown of the previously input
    > text.
    > What event creates that behavior and how do I stop it ?


    This is a browser feature. Presumably the user chose the browser
    because the browser's features are appealing. Yes some of these
    browser features are aggravating at times. It isn't really a good idea
    to be trying to change how the browser works. I don't know if you can
    even have any affect on this situation.

    Peter
    Peter Michaux, Jun 17, 2007
    #2
    1. Advertising

  3. Randy Webb Guest

    Peter Michaux said the following on 6/17/2007 5:23 PM:
    > On Jun 17, 7:32 am, wrote:
    >> When you press the down key while in an input field the default
    >> behavior for some event creates a dropdown of the previously input
    >> text.
    >> What event creates that behavior and how do I stop it ?

    >
    > This is a browser feature. Presumably the user chose the browser
    > because the browser's features are appealing. Yes some of these
    > browser features are aggravating at times. It isn't really a good idea
    > to be trying to change how the browser works. I don't know if you can
    > even have any affect on this situation.


    It is an auto-fill feature and no, you can't have any effect on it's
    behavior.

    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
    Randy Webb, Jun 18, 2007
    #3
  4. Guest

    On Jun 17, 9:37 pm, Randy Webb <> wrote:
    > Peter Michaux said the following on 6/17/2007 5:23 PM:
    >
    > > On Jun 17, 7:32 am, wrote:
    > >> When you press the down key while in an input field the default
    > >> behavior for some event creates a dropdown of the previously input
    > >> text.
    > >> What event creates that behavior and how do I stop it ?

    >
    > > This is a browser feature. Presumably the user chose the browser
    > > because the browser's features are appealing. Yes some of these
    > > browser features are aggravating at times. It isn't really a good idea
    > > to be trying to change how the browser works. I don't know if you can
    > > even have any affect on this situation.

    >
    > It is an auto-fill feature and no, you can't have any effect on it's
    > behavior.
    >
    > --
    > Randy
    > Chance Favors The Prepared Mind
    > comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
    > Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/


    Ok thanks. I found out I can trick the autocomplete into not appearing
    by having a start value of ' '. The autocomplete doesn't seem to work
    at all if the first letter is a blank, even if previous searches
    started with a blank. After that it will only appear if the user
    deletes everything in the field, which doesn't usually happen, so it
    effectively solves the problem.

    The input field is for text to search for in an associated drop down,
    to make it easier to find the right item in the dropdown. As each
    letter is entered the selection moves to the correct choice in the
    dropdown. In other words, it acts like autocomplete but instead of
    adding the finished text to the input field, it hilights the finished
    text in the dropdown. The default autocomplete just gets in the way.
    I just have to make sure the search for the right item can work even
    if the first letter is a blank, plus it must ignore the blank. But all
    that was easy because all the search does is check to see where the
    text lands alphabetically in the select list, and this automatically
    ignores the spaces. In other words, " ABC" is effectively the same as
    "ABC"

    This is not for web customers, it is for people who spend all day on
    the page filling phone orders. I'm trying to eliminate as many
    keystrokes as possible, and the autocomplete takes an extra mouse
    click to get rid of it.
    , Jun 20, 2007
    #4
    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. nicholas
    Replies:
    1
    Views:
    5,031
    Kevin Spencer
    Dec 16, 2004
  2. vishnu
    Replies:
    1
    Views:
    1,181
    Patrick.O.Ige
    Mar 25, 2006
  3. Mike
    Replies:
    1
    Views:
    788
  4. Eric
    Replies:
    4
    Views:
    331
    Alexey Smirnov
    Nov 9, 2008
  5. Replies:
    1
    Views:
    187
Loading...

Share This Page