[jsr-314-open] FYI: onchange for radio and checkbox

Jim Driscoll Jim.Driscoll at Sun.COM
Wed Aug 12 17:27:37 EDT 2009


Just an FYI.

Previously, in Mojarra, the default ajax behavior for components that 
rendered radio and checkbox was onchange.

Unfortunately, this doesn't work in the way any user would expect in IE 
- the onchange event will not fire until the component loses focus. 
This makes it pretty much useless, as a user will click on a radio 
button then wonder why nothing is happening.  Note that all other 
browsers fire the onchange event when you'd expect - without waiting for 
a blur event first.

So, in the interests of making all browsers behave similarly, I've 
changed the default behavior to onclick for those components.  Now, when 
you click on a radio or checkbox, the event will fire immediately. 
Sadly, this means that we'll now also fire events even when the value 
isn't changed (such as clicking multiple times on the same radio 
button).  In general, most application developers shouldn't notice the 
difference, but it's conceivable that it might trip someone up at some 
point.    The alternative, adding an onclick="this.blur();", seemed more 
likely to add problems than a simple change from onchange to onclick.

Just wanted to let you know where we stood with this.  As always, 
comments appreciated.

Jim




More information about the jsr-314-open-mirror mailing list