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

classic Classic list List threaded Threaded
2 messages 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
Reply | Threaded
Open this post in threaded view
|

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

Erik Bruchez
Administrator
Adrian,

Thanks for the detailed analysis of the issue. I reproduced this and I
entered a bug:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=306169&group_id=168&atid=350207

xforms.js already contains some special cases for IE, so this would just
be another one of those... I would prefer waiting until Alex comes back
before fixing this as he may have a better idea as to where to put this
code in xforms.js.

-Erik

Adrian Baker wrote:

> 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
--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



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