select bug in IE

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

    #1

    select bug in IE

    Hi

    I'm trying to dynamically add content to a select box when it is
    clicked (because the app that I am developing contains many, many
    select boxes with huge lists that are just way too slow to populate on
    page load).

    I have written code that works fine in gecko based browsers but in
    Internet Explorer 6 after the select is populated, it is resized and
    the popup is closed before the user can select an option. I have tried
    returning false from onmousedown/onmouseup/onclick if the select is not
    yet populated, I have tried setting a timeout to call the Click()
    method (or the onclick/onmouseup/onmousedown method) if it isn't
    populated but I can't seem to stop the popup list disappearing in IE6.

    Any ideas appreciated.
    (Stripped-down example code follows)

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
    <html>
    <head>
    <title>Select Bug TestBed</title>
    <script>
    function LazyPopulate(el em)
    {
    if(elem.populat ed == null)
    {
    //Copy the list items across
    for(var j = 1 ; j < 10 ; j++)
    {
    elem.options[j]=new Option("new"+j, "value"+j);
    }
    elem.populated= true;
    }
    }
    </script>
    </head>
    <body>
    <select id="sel" onclick="LazyPo pulate(this);">
    <option>first </option>
    </select>
    </body>
    </html>

  • RobB

    #2
    Re: select bug in IE

    JonQuark wrote:[color=blue]
    > Hi
    >
    > I'm trying to dynamically add content to a select box when it is
    > clicked (because the app that I am developing contains many, many
    > select boxes with huge lists that are just way too slow to populate[/color]
    on[color=blue]
    > page load).
    >
    > I have written code that works fine in gecko based browsers but in
    > Internet Explorer 6 after the select is populated, it is resized and
    > the popup is closed before the user can select an option. I have[/color]
    tried[color=blue]
    > returning false from onmousedown/onmouseup/onclick if the select is[/color]
    not[color=blue]
    > yet populated, I have tried setting a timeout to call the Click()
    > method (or the onclick/onmouseup/onmousedown method) if it isn't
    > populated but I can't seem to stop the popup list disappearing in[/color]
    IE6.[color=blue]
    >
    > Any ideas appreciated.
    > (Stripped-down example code follows)
    >
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
    > <html>
    > <head>
    > <title>Select Bug TestBed</title>
    > <script>
    > function LazyPopulate(el em)
    > {
    > if(elem.populat ed == null)
    > {
    > //Copy the list items across
    > for(var j = 1 ; j < 10 ; j++)
    > {
    > elem.options[j]=new Option("new"+j, "value"+j);
    > }
    > elem.populated= true;
    > }
    > }
    > </script>
    > </head>
    > <body>
    > <select id="sel" onclick="LazyPo pulate(this);">
    > <option>first </option>
    > </select>
    > </body>
    > </html>[/color]

    You mentioned 'popup', as in...'popup window'? Unclear.

    Try the onfocus handler instead. How 'huge' are we talking here? #:=0

    Comment

    • JonQuark

      #3
      Re: select bug in IE

      Hi Rob,
      [color=blue]
      >You mentioned 'popup', as in...'popup window'? Unclear.[/color]
      I mean that when you click on a select box, a list of options "pops
      up", if you dynamically change the list of options in the
      onclick/onmousedown handler, IE (But not Firefox) closes this list of
      options (try the example HTML at the top of this thread if I'm still
      being unclear)
      [color=blue]
      >Try the onfocus handler instead.[/color]
      Thanks for the suggestion but if the lazypopulate() routine is called
      there, IE still closes the options-list.

      How 'huge' are we talking here? #:=0
      It's a big Intranet app for an internal project, we have a lot of data
      on a page, normally
      there are maybe 20 or 30 selects on a page each with a maximum of 20
      or 30 options. However it is the edge cases that make this
      lazypopulate() so attractive.
      It is possible to have hundreds of selects on a page with some of them
      having a few hundred options. In testing it is very slow, but as the
      user only wants to alter a few of these selects the lazypopulate fixes
      it. In Gecko browsers now, we have an increasingly slick front-end but
      we can't stipulate W3C compliant browsers only for this project
      unfortunately.

      Any other thoughts or ideas appreciated.

      Jon.

      Comment

      Working...