tags:

views:

556

answers:

1

Hi,

Can I rerender a jsf ui component when a valuechangelistener method is run? The reason i'm asking is that my valuechangelistener method changes the values of the input boxes in the backing bean but they don't seem to be rerender. What happens eventually is that the values that are printed on screen are saved to the backing bean, overriding the values loaded through the valuechangelistener method.

The following doesn't work:

<h:inputText id="inputbox_id" value="#{name}"/>
<h:selectOneMenu valueChangeListener="#{myBean.changeCountryMenu}">
  <a4j:support event="onchange" rerender="inputbox_id" action="#{bean.test}>
</h:selectOneMenu>

Notice that bean.test() is never run. (UPDATE: It does, I had a renderResponse() that skipped it before. The values still do not reRender though) So the solution I thought of is to rerender the inputbox from the valueChangeListener. If there is some other better solution i'd be glad to hear...

Thank you! Ben.

+1  A: 

The attribute name is reRender (with capital R the second time). Perhaps you have to add immediate="true" ?

Also, check this article

Bozho
Thanks... In the actual code it's written correctly..
Ben
@Ben then copy-paste the actual code and change only the names..
Bozho
@Bozho - Thanks. I've read the article by BalusC about jsf lifecycles and realized that my problem needed a better understanding of JSF lifecycles. (http://balusc.blogspot.com/2006/09/debug-jsf-lifecycle.html)
Ben
then I'll at least add the link to my answer, so that there is a reason to be marked as accepted.
Bozho