webtier@glassfish.java.net

Re: [webtier] Radio button onchange+ajax

From: Jim Driscoll <Jim.Driscoll_at_Sun.COM>
Date: Mon, 27 Jul 2009 11:44:21 -0700

I should say:

There is a workaround.

If you're on IE, then register an onfocus function that periodically
removes the focus. Eww.

We may have to do this for JSF. I've been thinking about it.

Jim

On 7/27/09 10:20 AM, Jim Driscoll wrote:
> What browser are you using? I bet it's IE. Further, I bet it works on
> Firefox, doesn't it? And Safari, too, right? (You are testing on more
> than one browser, right?)
>
> Is what you're seeing related to the buttons losing focus? I.e., is the
> event only being fired when the focus is lost?
>
> I IE only fires the onchange event when you surrender focus on the tag -
> which is why you're only seeing it sometimes.
>
> See here:
>
> http://msdn.microsoft.com/en-us/library/ms536912%28VS.85%29.aspx
>
> From that page:
>
> This event is fired when the contents are committed and not while the
> value is changing. For example, on a text box, this event is not fired
> while the user is typing, but rather when the user commits the change by
> leaving the text box that has focus. In addition, this event is executed
> before the code specified by onblur when the control is also losing the
> focus.
>
> The onchange event does not fire when the selected option of the select
> object is changed programatically.
>
> --------- End Quote -----------
>
> One more reason to hate Microsoft. No other browser does this, AFAIK.
>
> No, I don't know of a workaround. If anyone does... I'd love to hear it.
>
> When reporting JavaScript client problems *always* say which browser
> you're seeing the problem in - the default is of course IE, but hey,
> Safari has bugs too.
>
> Jim
>
> On 7/27/09 12:54 AM, webtier_at_javadesktop.org wrote:
>> Hi,
>>
>> I have a SelectOneRadio:
>>
>> <h:selectOneRadio valueChangeListener="#{testBean.toggle}" id="sor"
>> value="#{testBean.goods}" onchange="jsf.ajax.request(this, event,
>> {execute: 'sor', render: 'pg1'}); return false;">
>> <f:selectItem itemLabel="goods" itemValue="1" />
>> <f:selectItem itemLabel="service" itemValue="0" />
>> </h:selectOneRadio>
>>
>> When i click on the radio buttons, sometimes, the valuechangelistener
>> won't get called. It takes one or two other click, to to get it
>> called. The problem only exists with ajax+onchange.
>>
>> Can you reproduce the problem?
>> [Message sent by forum member 'gabox01' (gabox01)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=357632
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>