473,657 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="documen t.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 7637
In article <d5************ *************@p osting.google.c om>,
ry*********@hot mail.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 misunderstandin g 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*********@ho tmail.com> wrote in message
news:d5******** *************** **@posting.goog le.com...
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="documen t.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*********@ho tmail.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$T r4.1597618@attb i_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*********@ho tmail.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/rasterTriangleD OM.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

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

Similar topics

4
6483
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 checked, and the ALT property only shows up for the IMG tag. Can anyone help me with how to implement this? What they want is some amplification to the list selections. TIA Ron Lounsbury
4
6431
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 clicks selects the country then the destination select box shows the destinations in that country and further if he chooses destination all
5
35133
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 the options using OPTGROUPs. <select name="Selector1" size="1" onchange="reload2(this.options.selectedIndex, document.Form1.Selector2)"> <option ..... </select>
1
2787
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 but not IE. Yet this link shows Microsoft advertising that the disabled attribute is supported by them.
44
2818
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
1653
by: PW | last post by:
Is it possible to make a select list item red based on a condition ? TIA, PW
1
4609
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 can give each optgroup individual ID, e.g. id="group1"..."group"17). e.g. the html code looks like: <select name="mySelect" id="mySelect"> <optgroup label="First group" id="group1" > <option value="a" > Item A
4
5354
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 doesn't happen with IE7. There's a little program below which illustrates the problem. I create two multi-line select boxes. The first one has an optgroup and an option specified in the HTML. That one displays with "opt1" as the first line. The...
2
3260
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 goofiness of the current look. The idea is a new month will be added to the list each month (hence two option groups right in a row. But what is also missing is the closing tag for the 2008 options group. So I need examples for the start and close...
0
8823
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8726
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8603
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7320
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1604
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.