Adriaanse B

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...

  1. put the mouse pointer on the select box;
  2. click to open the select box;
  3. press "arrow down" on the keyboard;
  4. 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...



Re: Internet Explorer Web Development IE7 problem: selected option in select

Wesley Brandi - MSFT

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





Re: Internet Explorer Web Development IE7 problem: selected option in select

Kun Cong - MSFT

This is a known issue. This is because of some issue in DBLCLICK processing. We're going to fix this issue in next release.



Re: Internet Explorer Web Development IE7 problem: selected option in select

Adriaanse B

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...





Re: Internet Explorer Web Development IE7 problem: selected option in select

Adriaanse B

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





Re: Internet Explorer Web Development IE7 problem: selected option in select

jcooke

Is it possible this issue could cause the field to not have a value when posted Recently(last couple months) we've had reports of updates to a particular form not updating data correctly, after logging the sql statements, it appears that the value for that select box is not being printed correctly, "value = " instead of "value = 0". If this is the case would a multiple select be a better choice




Re: Internet Explorer Web Development IE7 problem: selected option in select

krisgale

i definitely would like to know more about this.
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.




Re: Internet Explorer Web Development IE7 problem: selected option in select

unique_username

This happens in Firefox too.

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




Re: Internet Explorer Web Development IE7 problem: selected option in select

krisgale

a potential workaround (that no one is likely to enjoy) --> attach an onkeypress (or onkeydown) event that voids any keyboard input so that the user Must click an option




Re: Internet Explorer Web Development IE7 problem: selected option in select

krisgale

<html>
<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">&nbsp;</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.




Re: Internet Explorer Web Development IE7 problem: selected option in select

krisgale

http://krisgale.com/three-things-a-web-developer-might-do-to-force-feed-their-applications-to-internet-explorer-7/