No rerender after validation failed
avi Dec 4, 2008 3:38 PMI have the following problem.
I have two required field x1 and x2 and a save button. On every change x.swap is called via a4j:support. If both field have not null value then swap swaps the value of the two field.
Everything works fine except there is a validation error. After that the fields are not rerendered.
Scenario: I write 1 into the first field (x1) then I click on save. Value is required message comes. Now I write 2 into the second field (x2). The x.swap is called and the second field is rerendered but the first field does not. It still shows 1 but the field x.x1 have the value 2. I debugged and x.getX1() is not even called after I clicked save.
In our project this happens everywhere where a field is calculated based on other fields. After a validation error these fields stop rerendering.
We use Seam 2.0.2.SP1 + JBoss 4.2.3.GA + RichFaces 3.2.2.SR1. But I tried different Seam and RichFaces versions and got the same result.
I ran out of any idea. So any help is appreciated.
Here is the x.xhtml
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"> <body> <h:form> <rich:messages></rich:messages> <s:validateAll> <h:inputText id="X1" value="#{x.x1}" required="true"> <a4j:support eventsQueue="queue" event="onchange" ajaxSingle="true" action="#{x.swap}" reRender="X1,X2" /> </h:inputText> <h:inputText id="X2" value="#{x.x2}" required="true"> <a4j:support eventsQueue="queue" event="onchange" ajaxSingle="true" action="#{x.swap}" reRender="X1,X2" /> </h:inputText> <a4j:commandButton value="save" eventsQueue="queue" action="#{x.save}" reRender="X1,X2" /> </s:validateAll> </h:form> </body> </html>
And x.java
@Stateful @Name("x") @Conversational public class X implements XLocal { private Integer x1; private Integer x2; @Begin @Create public void create() { } public Integer getX1() { return x1; } public void setX1( Integer pX1 ) { x1 = pX1; } public Integer getX2() { return x2; } public void setX2( Integer pX2 ) { x2 = pX2; } public void swap() { if(x1==null || x2==null) return; Integer x = x1; x1=x2; x2=x; } public void save() { } @Destroy @Remove public void destroy() { } }