write into drop down box- Possible ????

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Filiz Duman

    write into drop down box- Possible ????

    I was just wondering, is it possible to write into the drop down box in
    order to jump to a specific item. The reason why I am asking is my drop down
    box has many items and additionally to the scrolling down, it would be good
    if the user can write into the box in order to get the specific entry the
    list selected.
    Is this possible ?
    Thanks.


  • lallous

    #2
    Re: write into drop down box- Possible ????

    Hello,
    Sure, you can add new items to the listbox:

    <html>
    <head>
    <title> New Document </title>
    <meta name="Generator " content="EditPl us">
    <meta name="Author" content="">
    <meta name="Keywords" content="">
    <meta name="Descripti on" content="">
    </head>

    <body>
    <script>
    function addEntry(frm)
    {
    frm.s.options[frm.s.options.l ength] = new Option(frm.t.va lue,
    frm.t.value);
    }
    </script>
    <form name='f'>
    New entry:<input type='text' value='[value]' name='t'><input type='button'
    onclick='addEnt ry(this.form);' value='add entry'>
    <br>
    Listbox:
    <select name='s'>
    <option value='line1'>L ine1</option>
    </select>
    </form>
    </body>
    </html>

    "Filiz Duman" <none@aol.com > wrote in message
    news:bulkdo$g23 $1@visp.bt.co.u k...[color=blue]
    > I was just wondering, is it possible to write into the drop down box in
    > order to jump to a specific item. The reason why I am asking is my drop[/color]
    down[color=blue]
    > box has many items and additionally to the scrolling down, it would be[/color]
    good[color=blue]
    > if the user can write into the box in order to get the specific entry the
    > list selected.
    > Is this possible ?
    > Thanks.
    >
    >[/color]


    Comment

    • Filiz Duman

      #3
      Re: write into drop down box- Possible ????


      "lallous" <lallous@lgwm.o rg> wrote in message
      news:bulubm$jc6 4i$1@ID-161723.news.uni-berlin.de...[color=blue]
      > Hello,
      > Sure, you can add new items to the listbox:
      >
      > <html>
      > <head>
      > <title> New Document </title>
      > <meta name="Generator " content="EditPl us">
      > <meta name="Author" content="">
      > <meta name="Keywords" content="">
      > <meta name="Descripti on" content="">
      > </head>
      >
      > <body>
      > <script>
      > function addEntry(frm)
      > {
      > frm.s.options[frm.s.options.l ength] = new Option(frm.t.va lue,
      > frm.t.value);
      > }
      > </script>
      > <form name='f'>
      > New entry:<input type='text' value='[value]' name='t'><input type='button'
      > onclick='addEnt ry(this.form);' value='add entry'>
      > <br>
      > Listbox:
      > <select name='s'>
      > <option value='line1'>L ine1</option>
      > </select>
      > </form>
      > </body>
      > </html>
      >
      > "Filiz Duman" <none@aol.com > wrote in message
      > news:bulkdo$g23 $1@visp.bt.co.u k...[color=green]
      > > I was just wondering, is it possible to write into the drop down box in
      > > order to jump to a specific item. The reason why I am asking is my drop[/color]
      > down[color=green]
      > > box has many items and additionally to the scrolling down, it would be[/color]
      > good[color=green]
      > > if the user can write into the box in order to get the specific entry[/color][/color]
      the[color=blue][color=green]
      > > list selected.
      > > Is this possible ?
      > > Thanks.
      > >
      > >[/color]
      >[/color]

      Thanks, but I did not mean writing in the sence of entering a new item into
      the drop down box. I meant writing in the sence of entering the first letter
      and then the second etc. and with this I would jump to that specific item
      directly rather then scrolling to it ! (Mainly needed because my list is
      quite long, so the user should have the possiblity to jump to the item
      rather then scrolling all items in the drop down list !)

      [color=blue]
      >[/color]


      Comment

      • Richard Cornford

        #4
        Re: write into drop down box- Possible ????

        "lallous" <lallous@lgwm.o rg> wrote in message
        news:bulubm$jc6 4i$1@ID-161723.news.uni-berlin.de...
        <snip>[color=blue]
        >frm.s.option s[frm.s.options.l ength] = new Option(frm.t.va lue,[/color]
        <snip>

        Though there is at leas one current browser that lakes the Option
        constructor so it would be a good idea to check it exists prior to using
        it (and consider the consequences of a design that requires it).

        Richard.


        Comment

        • Michael Winter

          #5
          Re: write into drop down box- Possible ????

          On Wed, 21 Jan 2004 10:31:20 +0000 (UTC), Filiz Duman <none@aol.com > wrote:
          [color=blue]
          > I was just wondering, is it possible to write into the drop down box in
          > order to jump to a specific item. The reason why I am asking is my drop
          > down box has many items and additionally to the scrolling down, it
          > would be good if the user can write into the box in order to get the
          > specific entry the list selected.[/color]

          A SELECT element is a drop-down menu, or list box, only. You can only type
          in INPUT and TEXTAREA boxes. In general, pressing a key in a drop-down
          menu will take you to the first option that begins with that character[1].

          The best you do, reliably, is make access easier for your users through
          organisation. A couple of ideas...

          - If possible, group items into catagories, and order them alphabetically,
          numerically, or by some other logical order.
          - If there are distinct groups, use two menus. The first should hold the
          catagories. The second is then populated when a catagory is selected. This
          can be done with JavaScript, but a non-JavaScript alternative (usually
          implemented server-side) must be provided whenever possible[2].

          Mike

          [1] That isn't guaranteed behaviour.
          [2] In fact, implementing this style *properly* could be quite involving.

          --
          Michael Winter
          M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

          Comment

          • Dennis M. Marks

            #6
            Re: write into drop down box- Possible ????

            I have read the following message from "Filiz Duman" <none@aol.com >
            and have decided to lend my vast knowledge.

            <snip>[color=blue]
            >
            > Thanks, but I did not mean writing in the sence of entering a new item into
            > the drop down box. I meant writing in the sence of entering the first letter
            > and then the second etc. and with this I would jump to that specific item
            > directly rather then scrolling to it ! (Mainly needed because my list is
            > quite long, so the user should have the possiblity to jump to the item
            > rather then scrolling all items in the drop down list !)
            >
            >[/color]

            and my reply is:
            If you change your drop down box to a scrolling list (make lines
            greater than 1) it will automatically scroll when you type a single
            letter. At least it does on my browser. You first select the first item
            in the list and then type a letter.

            The only problem is when you select the first item an onchange event
            takes place. You may need a separate button to activate the selection.

            See my Amtrak page at my web site http://www.dcs-chico.com/~denmarks/

            There is a list of hundreds of stations and it will scroll with no
            special coding after selecting the first item.

            --
            Dennis M. Marks

            Replace domain.invalid with dcsi.net


            -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
            http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
            -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

            Comment

            • Scott Navarre

              #7
              Re: write into drop down box- Possible ????

              Yes, I would think you can just add an input text box to go along with
              your drop-down box, and then everytime a key is pressed in the text box, use
              a javascript loop to look thru the drop-down box's options[i].text for a
              match with what is currently contained in your text box. If it finds a
              match, then set that matching option[i].selected to "true" and it will
              automatically scroll to the newly selected option[i].



              Comment

              Working...