My problem has to do with the following code:
<select id='myselect' onchange='alert(this.value);'>
<option value='1'>test1</option>
<option value='2'>test2</option>
</select>
If I execute this code and change my selection the onchange event is fired. And the alert shows my choice. But if I do this in a specific way than I got a problem, because the event is not raised...
- put the mouse pointer on the select box;
- click to open the select box;
- press "arrow down" on the keyboard;
- click the mouse again to close the select box;
If you do this quick enough (keep trying for a while) you will notice that the onchange event is not fired, but on screen the choise is already made. So I see my choise "2" but I don't get an alert "2". In my opinion tis is a render problem of the select box...
More on this problem: http://seclists.org/vuln-dev/2006/Nov/0004.html
If the onchange (or any other event) is not fired I cannot rely on my form anymore... So... Is there a solution for this problem Has anyone else encountered this problem
BTW: This IE7 only...

IE7 problem: selected option in select
Cest la vie
Hi,
I just wanted to confirm the behaviour you are seeing i.e. I am able to reproduce it here as well. I think you may be able to increase the likelihood of seeing the bug if you decrease the double click speed of your mouse in the control panel.
Anyway, I will confirm whether or not this is a known bug (and if a workaround exists) and get back to you.
Regards,
Wesley
Murre
JTechOnlineGuy
<head>
<title>select</title>
<script type="text/javascript">
function frmslct()
{ var frm = document.forms["frm"];
var fld = frm["slct"];
var val = fld.options[fld.selectedIndex].value;
document.getElementById("dsplyval").innerHTML = val;
}
</script>
</head>
<body>
<form name="frm">
<select name="slct" onchange="frmslct();" onpropertychange="frmslct();" onkeyup="frmslct();">
<option value="1">a</option>
<option value="2">b</option>
<option value="3">c</option>
<option value="4">d</option>
<option value="5">e</option>
</select>
</form>
<hr />
<div id="dsplyval"> </div>
</body>
</html>
i have no way of testing this in ie7 since i don't have windows xp (running windows 2000) but from what i've read, this Might cover all bases in terms of making up for the shortcomings of onchange. hopefully someone will give this a try and report back.
sarath_mankara
As a developer, I actually find this behavior helpful, because I can choose when to trigger the onchange event, however it is definately a bug in both browsers.
Just a heads up to the other developers on this thread, there is a few things that you should keep an ey out for.
1.) As noted, the onchange event does not fire if you use both the mouse and the keyboard in select lists.
2.) The onchange event does NOT fire, when a user selects a value from the browsers autocomplete list (e.g. if you turn on autocomplete, and you choose a value you stored previously)
3.) In IE, the onchange event does NOT fire, on a radio button, UNTIL you de-focus the field... workaround for IE is to use the onclick event, and determine if a change took place.
4.) I don't recall the specifics, but I believe there are issues in IE, with the onclick event, on the option element (which is what I was first thinking of using, to solve #1.
Cheers,
un
donkaiser
MrPerez
rwbogosian
i don't use them often but a few of my applications have onchange events that have recently gone pear-shaped with the release of ie7.
omrivm
oke, thanks for the quick answers.
But it raises some new questions:
Is this going to be patched or do I have to wait untill a next release (when ). Is there some kind of quick fix for me as a webdeveloper (I don't want to ban IE7-users from my site untill this is fixed)
Thanks in advance...
ROSE3000
Scythen
Another question comes to mind.
If Microsoft will update this error. What will happen to the persons that will not download this patch As a webdeveloper I want to know if the client logged-in to my application will not make mistakes in his or her input. Is there a way to check if this error occurres in a specific version of IE7
And again, when will there be a patch for this problem
tnx in advance