Connecting Tech Pros Worldwide Forums | Help | Site Map

Dropdown Issue in IE with Dynamically Populated SELECT Field (Bug??)

philaphan80@yahoo.com
Guest
 
Posts: n/a
#1: Jul 23 '05
Hello,

I'm trying to dynamically load a list of teams into a SELECT field
(dropdown / combo box) when a user clicks on the field. (The teams are
pre-loaded into JS arrays via ASP/SQL -- not shown.)

My problem is when I click on the box, the team loading *works*, but
it's performing a funky action. Upon click, it drops down once and the
teams are there. But in a split second (once the box drops down to its
bottom limit) the screen flickers and the box rolls back up to its
original state. (It almost appears as if I clicked twice on the box.)

I've tried onclick, onmousedown, onfocus... none work right. I even
tried appendChild with no luck.

I'm using Internet Explorer to view the page and I'm only targeting IE
since a very small number of users will be loading this page. I loaded
it into Firefox, Netscape and Opera just for kicks, though -- Firefox
and Netscape performed the action correctly and Opera didn't drop
anything down at all. (Nice.)

Anyway, is this a known bug in IE? Something I'm doing wrong? A
combination? Any help would be appreciated.


<select ... size="1" style="width: 175px;"
onmousedown="loadTeams(this)">
<option value="" selected></option>
</select>

<script>
function loadTeams(e) {
e.options.length = 0;
e.options.add(new Option("", "", true, false));

for (i=0; i < teamids.length; i++) {
e.options.add(new Option(teams[i], teamids[i], false, false));
}
}
</script>


Tim Williams
Guest
 
Posts: n/a
#2: Jul 23 '05

re: Dropdown Issue in IE with Dynamically Populated SELECT Field (Bug??)



<philaphan80@yahoo.com> wrote in message
news:1121876575.975335.255720@g43g2000cwa.googlegr oups.com...[color=blue]
> Hello,
>
> I'm trying to dynamically load a list of teams into a SELECT field
> (dropdown / combo box) when a user clicks on the field. (The teams
> are
> pre-loaded into JS arrays via ASP/SQL -- not shown.)
>
> My problem is when I click on the box, the team loading *works*, but
> it's performing a funky action. Upon click, it drops down once and
> the
> teams are there. But in a split second (once the box drops down to
> its
> bottom limit) the screen flickers and the box rolls back up to its
> original state. (It almost appears as if I clicked twice on the
> box.)[/color]

Why are you triggering the loading on clicking the select itself? You
would be much
better off having the optionsl oaded before the user interacts with
the select.


Tim.


philaphan80@yahoo.com
Guest
 
Posts: n/a
#3: Jul 23 '05

re: Dropdown Issue in IE with Dynamically Populated SELECT Field (Bug??)


Usually, I would agree. That would make my job *much* easier. ;)

There are several fields on the page and the users can only select the
item once (no duplicates.) Pre-loading would lead to potential
duplication. I could always check for that before submitting the
form... but then a light bulb lit above my head and I thought it would
be snazzier (that's right, I said "snazzier") to have the fields
automatically load the remaining items on each click, thus eliminating
the duplication and verification.

The part that stinks the worst is that the logic works perfectly, but
the browser seems to be doing something funky. I was wondering if
anyone else ran into this (and possibly had a workaround......??)

Tim Williams
Guest
 
Posts: n/a
#4: Jul 23 '05

re: Dropdown Issue in IE with Dynamically Populated SELECT Field (Bug??)


The same logic applied to load the select when the user clicks on it
can be applied to load the select when the user makes a selection in
any of the other linked lists. Just have the change event delete the
selected option from the other lists.

Tim.


<philaphan80@yahoo.com> wrote in message
news:1121973108.844894.262860@g43g2000cwa.googlegr oups.com...[color=blue]
> Usually, I would agree. That would make my job *much* easier. ;)
>
> There are several fields on the page and the users can only select
> the
> item once (no duplicates.) Pre-loading would lead to potential
> duplication. I could always check for that before submitting the
> form... but then a light bulb lit above my head and I thought it
> would
> be snazzier (that's right, I said "snazzier") to have the fields
> automatically load the remaining items on each click, thus
> eliminating
> the duplication and verification.
>
> The part that stinks the worst is that the logic works perfectly,
> but
> the browser seems to be doing something funky. I was wondering if
> anyone else ran into this (and possibly had a workaround......??)
>[/color]


philaphan80@yahoo.com
Guest
 
Posts: n/a
#5: Jul 23 '05

re: Dropdown Issue in IE with Dynamically Populated SELECT Field (Bug??)


Great minds think alike. ;)

Thanks for your help, Ted. I actually thought of the same thing
yesterday and implemented it. Works great!

I think what I'm experiencing is a bug or a "quirk", if you will, in
Internet Explorer. I left my original code in the page (commented out)
since it's a lot smaller than the workaround. But after running some
more tests on IE, hope for an actual solution is fading. It seems to
be the way the actual browser behaves and not something I'm doing.

Thanks again!

Closed Thread