Friday, May 25, 2007

Internet Explorer, Firefox, Opera, onChange and the fine art of checking boxes

Say you have an Apex page with a checkbox item and an onChange event handler attached to it.


If you are wondering why this page behaves differently when viewed with Firefox 2.0 and Opera 9.2 or with Internet Explorer 7.0, then you might find useful to know that
IE 7.0 will not fire the event until you move the focus to another element (by clicking somewhere else on the page for instance), whereas FF and Opera treat it much like the onClick event.

In order to make the behavior consistent across different browsers, i decided to replace onChange with onClick for checkboxes.

That's why i love sooo much javascript and its different implementations.

I didn't check if, at least, Internet Explorer is consistent across different versions, i'll leave this task as exercise for the student.

;-)

2 comments:

Patrick Wolf said...

Experienced the same problem a week ago when I did some development for my APEX Builder Plugin.

I really hate this cross-browser issues! :-(

Patrick

Andrew said...

It behaves the same way in ie6 and ie7.

yes you can!

Two great ways to help us out with a minimal effort. Click on the Google Plus +1 button above or...
We appreciate your support!

latest articles