473,408 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

IE Bug: onchange event not called when using <optgroup> in select drop-down

In a <select> drop-down, the onchange event isn't called when
scrolling through the dropdown using the mouse-wheel and when crossing
over a new <optgroup>.

Using the example below, notice how the onchange event isn't called
when mouse wheel scrolling between A3 and B1, but it works properly
when scrolling between A1 and A2.

E.g.
------------------------------------------
<html>
<body onload="document.forms['myForm'].elements['mySelect'].focus()">

<form name="myForm" id="myForm">
<select onchange="alert('onchange event');" name="mySelect"
id="mySelect">
<optgroup label="Group A">
<option value="A1">A1</option>
<option value="A2">A2</option>
<option value="A3">A3</option>
</optgroup>
<optgroup label="Group B">
<option value="B1">B1</option>
<option value="B2">B2</option>
<option value="B3">B3</option>
</optgroup>
<optgroup label="Group C">
<option value="C1">C1</option>
<option value="C2">C2</option>
<option value="C3">C3</option>
</optgroup>
</select>
</form>

</body>
</html>
------------------------------------------

Thanks,
Ryan McGeary
Jul 20 '05 #1
10 7615
In article <d5*************************@posting.google.com> ,
ry*********@hotmail.com (Ryan McGeary) writes:
In a <select> drop-down, the onchange event isn't called when
scrolling through the dropdown using the mouse-wheel and when crossing
over a new <optgroup>.
Nor should it be. The onchange event shouldnt fire until a different option
(optgroups are not options) has been chosen.
Using the example below, notice how the onchange event isn't called
when mouse wheel scrolling between A3 and B1, but it works properly
when scrolling between A1 and A2.


The only way I get an alert out of that code is after I choose a different
option and leave the select list. As it should be. If you are getting the alert
simply by scrolling through the options, then something else is wrong.

--
Randy
Jul 20 '05 #2
Randy,

Thanks for the reply, but I think there's a misunderstanding with my
issue.

First, I'm not selecting an optgroup. I'm selecting the next option in
the list (which happens to be in the next optgroup).

Second, it's important that you use the "mouse wheel" to select between
the options to realize the issue. Do not "drop-down" the select box.
In fact, what I can tell, the mouse wheel doesn't work when the select
box is "dropped-down"; it only works when the select box is focused but
not "dropped-down."

The code I provided initially focuses on the select box; simply use your
mouse wheel and new options will be selected.

If you mouse wheel scroll between A1 and A2, the onchange event is
correctly called; however, if you mouse wheel scrool between A3 and B1,
the onchange event isn't called. I believe it should be called.

Thanks,
Ryan McGeary

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3
"Ryan McGeary" <ry*********@hotmail.com> wrote in message
news:d5*************************@posting.google.co m...
In a <select> drop-down, the onchange event isn't called when
scrolling through the dropdown using the mouse-wheel and when crossing
over a new <optgroup>.

Using the example below, notice how the onchange event isn't called
when mouse wheel scrolling between A3 and B1, but it works properly
when scrolling between A1 and A2.

E.g.
------------------------------------------
<html>
<body onload="document.forms['myForm'].elements['mySelect'].focus()">

<form name="myForm" id="myForm">
<select onchange="alert('onchange event');" name="mySelect"
id="mySelect">
<optgroup label="Group A">
<option value="A1">A1</option>
<option value="A2">A2</option>
<option value="A3">A3</option>
</optgroup>
<optgroup label="Group B">
<option value="B1">B1</option>
<option value="B2">B2</option>
<option value="B3">B3</option>
</optgroup>
<optgroup label="Group C">
<option value="C1">C1</option>
<option value="C2">C2</option>
<option value="C3">C3</option>
</optgroup>
</select>
</form>

</body>
</html>
------------------------------------------

Thanks,
Ryan McGeary

I'd never heard of "optgroup" before so I went looking.

I found it under WAP (Wireless Application Protocol ).

http://www.w3schools.com/wap/tag_optgroup.asp

does not indicate that "label=" is supported.
Jul 20 '05 #4
In article <3f*********************@news.frii.net>, Ryan McGeary
<ry*********@hotmail.com> writes:
First, I'm not selecting an optgroup. I'm selecting the next option in
the list (which happens to be in the next optgroup).

Second, it's important that you use the "mouse wheel" to select between
the options to realize the issue. Do not "drop-down" the select box.
In fact, what I can tell, the mouse wheel doesn't work when the select
box is "dropped-down"; it only works when the select box is focused but
not "dropped-down."
It took me a few minutes of tinkering to find that out. When testing it in
other browsers, IE turned out to be the only one to allow that "feature" where
I could scroll a non-dropped select list with the mouse wheel.

The mouse wheel, for me, works when the select has a scrollbar, otherwise it
doesn't. But while mouse-wheeling through a select that works with it, it
doesn't "choose" anything, just mimics me dragging the scrollbars down.
The code I provided initially focuses on the select box; simply use your
mouse wheel and new options will be selected.

If you mouse wheel scroll between A1 and A2, the onchange event is
correctly called; however, if you mouse wheel scrool between A3 and B1,
the onchange event isn't called. I believe it should be called.


I found it now. Now it has me wondering when I will ever run across it in day
to day life :) I very seldom use the mouse wheel. I guess I have become too
accustomed to dragging scrollbars and clicking the arrows on select lists :(
--
Randy
Jul 20 '05 #5
In article <jtoFb.615562$Tr4.1597618@attbi_s03>, "McKirahan"
<Ne**@McKirahan.com> writes:
I'd never heard of "optgroup" before so I went looking.

I found it under WAP (Wireless Application Protocol ).

http://www.w3schools.com/wap/tag_optgroup.asp

does not indicate that "label=" is supported.


I looked it up in w3c's specs, and label is not there either. But the bug still
exists with the absence of the label attribute, so while its invalid HTML, its
not the source of the bug.
--
Randy
Jul 20 '05 #6
Yes, it is valid HTML:

http://www.w3schools.com/tags/tag_optgroup.asp

The "label" attribute is supported by optgroup. As far as not using in
daily life, I find the optgroup tags a very useful tool in building
webapps. It can really organize a drop down list.

Also, I'm sure you can see a reason to add an onchange event handler to
a drop down. Put these two together and you have this bug.

BTW, the bug also happens when using the arrow keys instead of the mouse
wheel. Some people prefer using the keyboard instead of the mouse, so
this even further amplifies the issue.

Thanks for everyone's help! Now how do we notify Microsoft to fix the
bug?

-Ryan

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #7
In article <3f*********************@news.frii.net>, Ryan McGeary
<ry*********@hotmail.com> writes:
Yes, it is valid HTML:

http://www.w3schools.com/tags/tag_optgroup.asp
I looked it up in the W3C site and granted, I didn't look long, but where I did
find optgroup, it listed no label attribute. I trust the W3C specs moreso than
the w3schools site. But the validity of the HTML isn't a point with me.
The "label" attribute is supported by optgroup. As far as not using in
daily life, I find the optgroup tags a very useful tool in building
webapps. It can really organize a drop down list.
I use it also. Thats not what I was referring to in the daily life situation.
Also, I'm sure you can see a reason to add an onchange event handler to
a drop down. Put these two together and you have this bug.
Absolutely.

But you have to add one more aspect of the situation to expose the bug. And
that final aspect is what I was referring to in "daily life use", namely - the
use of the scroll wheel on a non-dropped select list. I just don't deal with
selects that way. I use the mouse and keyboard, but I want to see the entire
list. If a person is not dropping the select, when using the keyboard, then the
optgroups become useless since they will never see them - same with the
collapsed mouse wheel situation.
BTW, the bug also happens when using the arrow keys instead of the mouse
wheel. Some people prefer using the keyboard instead of the mouse, so
this even further amplifies the issue.
I agree that its a bug. I also agree that some people prefer the keyboard (I do
at times). Its something I never would have encountered because the two ways of
invoking the bug are not typical ways I deal with select lists :(
Thanks for everyone's help! Now how do we notify Microsoft to fix the
bug?


In my almost 10 years, I have yet to find a reliable way to notify Microsoft of
a bug :(
--
Randy
Jul 20 '05 #8
hi************@aol.com (HikksNotAtHome) writes:
I looked it up in the W3C site and granted, I didn't look long, but
where I did find optgroup, it listed no label attribute. I trust the
W3C specs moreso than the w3schools site.


<URL:http://www.w3.org/TR/html4/interact/forms.html#h-17.6.1>
Under OPTGROUP it lists the attribute:
---
label %Text; #REQUIRED -- for use in hierarchical menus --
---
and just below
---
OPTGROUP Attribute definitions

label = text [CS]
This attribute specifies the label for the option group.
---

It's not only there, it's required.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #9
Thanks Lasse! I thought I was going crazy. :-)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #10
McKirahan wrote:
[...]
<select onchange="alert('onchange event');" name="mySelect"
id="mySelect">
<optgroup label="Group A">
[...]
</optgroup>
[...]

I'd never heard of "optgroup" before so I went looking.

I found it under WAP (Wireless Application Protocol ).

http://www.w3schools.com/wap/tag_optgroup.asp

does not indicate that "label=" is supported.


`optgroup' is an element of valid HTML 4.01
Strict/Transitional as of *December 1999*.

http://www.w3.org/TR/html/interact/f...#edef-OPTGROUP

You should update your knowledge from time to time.
PointedEars
Jul 20 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ron Lounsbury | last post by:
I have a customer who has requested that I add "popup" text (a la ToolTips) to a couple of pulldown lists in a DHTML form we have in our project. He says - Just use the ALT tag. I went and double...
4
by: point | last post by:
Hello there... I'm a PHP programmer and starting to learn JS... I have a following problem.... I have 3 select boxes! one is hotel one is destination and one is country... if someone...
5
by: cedawe | last post by:
I have two select boxes. When the user picks a value in the first one it completely re-populates the second one. It works fine, but only generates a standard OPTIONS list and I now want to group...
1
by: Stewart Cambridge London, UK | last post by:
I've been having some trouble with a set of <select><optgroup><option> dropdowns. I've been experimenting with the disabled attribute in the <optgroup> and <option> tags. Seems to work in NN...
44
by: rhythmace | last post by:
W3C HTML validator passes this: .... <script type="text/javascript" src="foo.js"> <script type="text/javascript"> ....script in here... </script> ....
2
by: PW | last post by:
Is it possible to make a select list item red based on a condition ? TIA, PW
1
by: TKapler | last post by:
I think i am quite experienced javascript programmer, but I got a problem. I have a selectbox with e.g. 17 optgroups with 100 options. I need a javascript code to hide some of that optgroups (i...
4
by: Patrick Nolan | last post by:
I am using javascript to manipulate optgroups in select elements. When the results are displayed in Firefox 2.0 there is an annoying blank line at the top of the multi-line select box. This...
2
Claus Mygind
by: Claus Mygind | last post by:
I am adding a select box on the fly to a menubar. For the most part straight forward. Just one little hangup. I want to add the Option Group. Not sure how that should be coded. Don't mind the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.