Thank you Stefan.

Actually, that was not the problem. You don't need to
manually call the renderResponse as JSF eventually
goes thru the RENDER_RESPONSE phase (unless you
intentionally cut short the cycle).

I've found out the reason why:

The backing bean is configured to be in the request
scope, so everytime the page gets rendered, a new bean
gets created. As a result, the checkbox value is
false. When this value is compared with the one stored
in the component tree, if the two values differ, JSF
will queue a ValueChangeEvent, otherwise it doesn't do
anything. That's why the ValueChangeListener is only
called when the checkbox is selected.


--- Stefan <[EMAIL PROTECTED]> wrote:

> I think what's happening is that your javascript is
> firing, but you've NOT
> done anything to change the Faces Servlet Lifecycle
> 
>  
> 
> To cause a re-render as a result of the valuechange
> event you need to
> include
> 
>  
> 
> public void onCheckBoxClicked(ValueChangeEvent evt)
> {
>         System.out.println("Checkbox is clicked");
>         Boolean b =
> ((Boolean)evt.getNewValue()).booleanValue();
>         setCheckBoxValue(b);
>  
>         FacesContext fC =
> FacesContext.getCurrentInstance();
>         fC. renderResponse();
> }
> 
>  
> 
>  
> 
> The problem with this is that you get a screen
> refresh (flicker) for every
> onclick event
> 
>  
> 
> 



        
                
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

Reply via email to