Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2002
    Posts
    32

    Question Unanswered: Limit listbox display?

    I'm using PHP and MySQL to load a listbox with values from a database. I have recently learned that a user who has Windows XP sees all the listbox choices at one time; when he clicks the arrow at the right side of the listbox, the options extend off the top and bottom of the screen and normal navigation keys do not allow him to scroll through the choices.

    So here's my question. Is it possible in PHP or HTML to still load all required values into a listbox (e.g., all 50 states) but only show 10 of them on screen at a time with a scroll bar when the user clicks the down arrow so that the user can scroll up or down through the remaining choices? I tried using a size command, but it showed that number of rows on screen all the time and took up too much space.

    Also, has anyone else run across this situation where a listbox is not limited to a maximum number of entries to display on screen at one time? Is this an XP thing? Something else?

    Thanks!

    Tim

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    <SELECT NAME="states" SIZE="10">
    <OPTION VALUE="AB">Bama</OPTION>
    <OPTION VALUE="CO">Colo</OPTION>
    <OPTION VALUE="DE">Uhoh</OPTION>
    ...
    <OPTION VALUE="YZ">Whynot</OPTION>
    </SELECT>

    if there are 50, you should still see only 10

    otherwise, XP is more b0rked than i feared


    rudy

  3. #3
    Join Date
    Oct 2002
    Posts
    32
    In my original post, I mentioned that I used a size command (SIZE=10) but the number of rows specified displayed on the web page all the time (and not just when the user clicked a down arrow), taking up too much space. Is there a way to specify a maximum possible list box length while still only displaying one item until the user clicks the down arrow to see other maximum number of options at a time?

    Again, thanks!

    Timm

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    what's the url? i gotta see this for myself


    rudy

  5. #5
    Join Date
    Oct 2002
    Posts
    32
    I can't post the URL. I can tell you that after additional testing, it looks as if the problem occurs when an XP user is running I.E. 6.0.2600.0000 and has not installed Service Pack 1.

    Another XP user running I.E. 6.0.2800.0000 (who installed the service pack) sees approximately 25 rows of a listbox at a time, and the listbox does not extend beyond the length of his screen.

    At this point, I still haven't heard back from the person who reported the problem if the service pack resolved it.

    Just the same, if there is a way in code to set a maximum display length once the down arrow of a listbox is clicked, I'd like to know what it is.

  6. #6
    Join Date
    Oct 2002
    Posts
    32
    P.S. I received this reply from a post on another forum:
    -------
    You can't do what you are trying to do.

    These are browser specific actions that will be difficult if not impossible to control correctly on all platforms, as you are demonstrating.

    You might be able to create a layer or iframe in some browsers that you would then control using javascript and cascading stylesheets, and you could that way replicate the behavior you describe.

    If it seems very important, could I suggest that you start learning about DHTML, which would be the method you'd use to achieve this. Be prepared to learn a lot of code and concepts.

    Neither PHP nor HTML nor javascript alone will do this trick.
    -------

  7. #7
    Join Date
    Oct 2002
    Posts
    32
    Installing Service Pack 1 did fix the problem.

    Timm

  8. #8
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    okay, thanks for letting us know

    whew!


    rudy

Posting Permissions

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