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:

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

    ReplyDelete
  2. It behaves the same way in ie6 and ie7.

    ReplyDelete

I appreciate your comment however bear in mind that I might not have the time to reply soon.
Normally I do not reply to all comments but I am glad if you found something useful or if you learned something new, in that case I strongly encourage you to promote the article with the +1 google button.
Flavio