bug: selecting newly created option in dropdown causes javascript error in IE

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

bug: selecting newly created option in dropdown causes javascript error in IE

Adrian Baker
If an interaction with a form results in a new option being added to a dropdown, and in the same action this new option becomes selected I get a javascript error.

The problem occurs on this line:
    option.selected = xformsArrayContains(selectedValues, option.value);

This seems to be some obscure problem with IE where if a option is added to the DOM then quickly set to selected an error occurs (see http://ianso.blogspot.com/2005/10/another-stupid-ie-bug-selectedindex-on.html, http://www.thescripts.com/forum/thread150463.html).

Workaround for IE is to use
    option.setAttribute('selected',xformsArrayContains(selectedValues, option.value));

but this won't work for Firefox...

Attached is example demonstrating the problem (which only occurs in IE) - click the add version link at the bottom to see the error.

Adrian


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

badItemsetUpdate.xhtml (30K) Download Attachment