Solved

Select list doesn't render or freezes when using onchange in IE10

Posted on 2013-05-23
7
1,113 Views
Last Modified: 2013-08-31
I've got the following HTML in an IE10 browser (below)

When clicking in the upper left <select> to trigger its "onchange", I expect the upper right select list to change its second row of text, using JavaScript.

However, this does not work OK.  
With my first click, the onchange function executes correctly, but the upper right select does not re-render at all. Nothing happens.
Succeeding clicks does change the upper right select list, but the rendering seems to be "one click behind". Subsequently moving the mouse over the second select field seems to trigger its rendering.

The lower <select> is even worse. Its onchange function is supposed to change the content of a row in the very same select list, itself.
When clicking to trigger the event, the select list "freezes" and becomes completely unresponsive, until I've moved focus to any other field (i.e. the upper select lists) and starts all over again.

In IE9 (and other browsers like Chrome, Firefox, IE8 etc) all works OK, just as expected.
But IE10 executes really annoyingly!

Any ideas?
Right now I'm testing with IE10 version 10.0.9200.16576
Does anybody get the above behaviour with other IE10 versions?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<script>
function SetList(field) {
  var now = new Date();
  field.options[1].text = 'set '+now.getTime();
}
</script>
</head>
<body>
<form name=TheForm>
Test 1 (set next field):
<select size=3 onChange="SetList(document.TheForm.Test1)">
  <option selected>First row
  <option>Click to set value in list to the right
  <option>Third row
</select>
<select size=3 name=Test1>
  <option selected>Choice 1
  <option>Choice 2
  <option>Choice 3
</select>
<br><br>
Test 2 (set itself):
<select name=Test2 size=3 onChange="SetList(document.TheForm.Test2)">
  <option selected>First row
  <option>Click to set value in same list
  <option>Third row
</select>
</body>
</html>

Open in new window

0
Comment
Question by:stefanlennerbrant
  • 4
  • 2
7 Comments
 
LVL 15

Expert Comment

by:Jagadishwor Dulal
ID: 39190784
I have fetch same problem somewhere but I forgot what i did exactly I think it was solved using  addEventListener.
0
 
LVL 15

Expert Comment

by:Jagadishwor Dulal
ID: 39190804
Again I want to refer you to microsoft :
http://support.microsoft.com/kb/319741
0
 

Author Comment

by:stefanlennerbrant
ID: 39191633
The MS KB link seems to refer to a bug in IE6, specifically relating to a "frameset situation"
Just for the sake of it, I tested by using addeventlistener to set all the event handlers to the select fields, but the problem was the same.

Anyhow, isn't there anyone that can actually repeat the issue using my HTML code above on an IE10 browser - resulting in "delayed rendering" of the upper select lists and freezing the lower select list?
Is there anybody that can make the page "work" correctly, just as it does in IE9 and other browsers?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 44

Assisted Solution

by:Rainer Jeschor
Rainer Jeschor earned 500 total points
ID: 39192179
Hi,
the final solution has been to add a
field.blur(); in the function.
As I ran a W3C validation I just modified the rest of the page as well, but here we go:
<!DOCTYPE HTML>
<html>
<head>
<title>Test</title>
<script type="text/javascript">
function SetList(field) {
  var now = new Date();
  field.options[1].text = 'set '+now.getTime();
  field.blur();
}
</script>
</head>
<body>
<form name="TheForm" action="#">
Test 1 (set next field):sss
<select size=3 onchange="SetList(document.TheForm.Test1)">
  <option selected>First row</option>
  <option>Click to set value in list to the right</option>
  <option>Third row</option>
</select>
<select size=3 name="Test1" id="Test1">
  <option selected>Choice 1</option>
  <option>Choice 2</option>
  <option>Choice 3</option>
</select>
<br><br>
Test 2 (set itself):
<select id="Test2" name="Test2" size=3 onchange="SetList(this);">
  <option selected>First row</option>
  <option>Click to set value in same list</option>
  <option>Third row</option>
</select>
</form>
</body>
</html>
                                  

Open in new window

0
 

Author Comment

by:stefanlennerbrant
ID: 39194029
Thanks, RainerJPos, adding blur() seems to be a step in the right direction.
It still doesn't seem to solve the case with the two upper select lists  (where IE10 does "delayed rendering") but it does avoid the freezing of the lower select list.

Instead adding focus() to explicitly set focus to another field, seems to solve the issue completely.

I will experiment more with this, but blur/focus really seems to be the fix here, for IE10.
I'll report back after more testing.

Does anybody know about this IE10 problem? Is it a known bug? I haven't found much on the internet...
0
 

Accepted Solution

by:
stefanlennerbrant earned 0 total points
ID: 39439067
Eventuelly I was able to work around the issue
I had to make sure that there was no "border" style on the field - I implemented that by setting
  field.style.border = '';
  field.className = '';
every time I changed the content of a select list.
This fixes the freezing behaviour.

It is also to some extent coupled with focus - I also had to blur the field that was in focus, and then (after a timeout of a few ms) reset focus to it again.
This fixes the "delayed rendering" behaviour.


All this however ONLY refers to multiple-row select lists, and only affects IE10.

Thus, problem solved, to the cost of not having my own choice of border on the select list field in IE10, and leaving me with a MSIE feeling of "duh"

Nobody else has experienced this?

Feel free to try to repeat the problem, I use the attached code snippet on IE10
Remove comments as noted, to workaround the problem

Note that all is good, all the time, in non-IE10 browsers.

/Stefan
EEselectIE10.htm
0
 

Author Closing Comment

by:stefanlennerbrant
ID: 39454693
Using blur and re-focus is half the solution.
Removing border from style is half the solution

Oh My, what should one without IE?
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now