All,
I
have come across an IE JavaScript bug which has been present since IE 6. It
occurs when using the getElementById() function (it is explained in detail here
http://www.csb7.com/test/ie_getelementbyid_bug/index.php).
I encountered the problem when using
ORBEON.xforms.Document.getValue()
I found a solution
(shown below) and integrated it under the ORBEON.xforms.Controls
ns.
Alex/Erik
I would suggest
changing all the references for document.getElementById to use this function to
avoid any possible problems. I changed getValue and setValue in my xforms.js and
it solved my problem
Thanks
Ryan
getControl: function(controlId){ var el = document.getElementById(controlId); // workaround bug in IE and Opera 8.2 where getElementById returns wrong element if (el && (el.id != controlId) && document.all) { el = null; // get all matching elements with this id els = document.all[controlId]; if (els) { // if more than 1, choose first with the correct id if (els.length) { for (var i=0; i < els.length; i++) { if (els[i].id == controlId) { el = els[i]; break; } } // return 1 and only element } else { el = els;} } } return el; }, Ryan
Puddephatt -- 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 |
Administrator
|
Ryan,
I didn't know about that one! Your code is now integrated with some changes to make it more consistent with the rest of xforms.js. It is under ORBEON.util.Dom.getElementById(). All the calls to document.getElementById() have been changed in calls to ORBEON.util.Dom.getElementById(). Alex On 12/13/06, Ryan Puddephatt <[hidden email]> wrote: > > > All, > I have come across an IE JavaScript bug which has been present since IE 6. It occurs when using the getElementById() function (it is explained in detail here http://www.csb7.com/test/ie_getelementbyid_bug/index.php). I encountered the problem when using ORBEON.xforms.Document.getValue() > > I found a solution (shown below) and integrated it under the ORBEON.xforms.Controls ns. > > Alex/Erik > I would suggest changing all the references for document.getElementById to use this function to avoid any possible problems. I changed getValue and setValue in my xforms.js and it solved my problem > > Thanks > > Ryan > > > getControl: function(controlId){ > > var el = document.getElementById(controlId); > > // workaround bug in IE and Opera 8.2 where getElementById returns wrong element > > if (el && (el.id != controlId) && document.all) { > > el = null; > > > > // get all matching elements with this id > > els = document.all[controlId]; > > if (els) { > > // if more than 1, choose first with the correct id > > if (els.length) { > > for (var i=0; i < els.length; i++) { > > if (els[i].id == controlId) { > > el = els[i]; > > break; > > } > > } > > // return 1 and only element > > } else { el = els;} > > } > > } > > return el; > > }, > > > > > > Ryan Puddephatt > Software Engineer > > > Teleflex Group - IT UK > 1 Michaelson Square > Livingston > West Lothian > Scotland > EH54 7DP > > e> [hidden email] > t> +44(0)1506 407 110 > f> +44(0)1506 407 108 > w> www.teleflex.com > > > -- Blog (XML, Web apps, Open Source): 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
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Alex,
I didn't relise that was there, I'll make sure I update my code to match Thanks Ryan Ryan Puddephatt Software Engineer Teleflex Group - IT UK 1 Michaelson Square Livingston West Lothian Scotland EH54 7DP e> [hidden email] t> +44(0)1506 407 110 f> +44(0)1506 407 108 >-----Original Message----- >From: [hidden email] [mailto:[hidden email]] On Behalf >Of Alessandro Vernet >Sent: 15 December 2006 23:12 >To: [hidden email] >Subject: Re: [ops-users] IE JavaScript Bug > >Ryan, > >I didn't know about that one! Your code is now integrated with >some changes to make it more consistent with the rest of >xforms.js. It is under ORBEON.util.Dom.getElementById(). All >the calls to >document.getElementById() have been changed in calls to >ORBEON.util.Dom.getElementById(). > >Alex > >On 12/13/06, Ryan Puddephatt <[hidden email]> wrote: >> >> >> All, >> I have come across an IE JavaScript bug which has been present >> since IE 6. It occurs when using the getElementById() >function (it is >> explained in detail here >> http://www.csb7.com/test/ie_getelementbyid_bug/index.php). I >> encountered the problem when using ORBEON.xforms.Document.getValue() >> >> I found a solution (shown below) and integrated it under >the ORBEON.xforms.Controls ns. >> >> Alex/Erik >> I would suggest changing all the references for >> document.getElementById to use this function to avoid any possible >> problems. I changed getValue and setValue in my xforms.js and it >> solved my problem >> >> Thanks >> >> Ryan >> >> >> getControl: function(controlId){ >> >> var el = document.getElementById(controlId); >> >> // workaround bug in IE and Opera 8.2 where getElementById returns >> wrong element >> >> if (el && (el.id != controlId) && document.all) { >> >> el = null; >> >> >> >> // get all matching elements with this id >> >> els = document.all[controlId]; >> >> if (els) { >> >> // if more than 1, choose first with the correct id >> >> if (els.length) { >> >> for (var i=0; i < els.length; i++) { >> >> if (els[i].id == controlId) { >> >> el = els[i]; >> >> break; >> >> } >> >> } >> >> // return 1 and only element >> >> } else { el = els;} >> >> } >> >> } >> >> return el; >> >> }, >> >> >> >> >> >> Ryan Puddephatt >> Software Engineer >> >> >> Teleflex Group - IT UK >> 1 Michaelson Square >> Livingston >> West Lothian >> Scotland >> EH54 7DP >> >> e> [hidden email] >> t> +44(0)1506 407 110 >> f> +44(0)1506 407 108 >> w> www.teleflex.com >> >> >> > > > >-- >Blog (XML, Web apps, Open Source): >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 |
Free forum by Nabble | Edit this page |