DataTable erroneously discard saved state when validation error in non child
field
----------------------------------------------------------------------------------
Key: MYFACES-721
URL: http://issues.apache.org/jira/browse/MYFACES-721
Project: MyFaces
Type: Bug
Components: General
Versions: 1.1.0
Reporter: Guillaume LE STUM
Data table state is reset when a validation error occurs but is neither in a
child component nor in a previous sibling.
Testcase:
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<f:view>
<h:form>
<t:div>First data table:</t:div>
<t:dataTable id="myTable1" var="tableRow1" value="#{list1}">
<h:column>
<h:inputText id="rowInput1"
value="#{tableRow1}" />
<h:message for="rowInput1"
errorStyle="color:red"/>
</h:column>
</t:dataTable>
<t:div>Single input field:</t:div>
<h:outputLabel for="inputLong">Long value (preferably
2...):</h:outputLabel>
<h:inputText id="inputLong" value="3">
<f:validateLongRange minimum="2" maximum="2" />
</h:inputText>
<h:message for="inputLong" errorStyle="color:red"/>
<t:div>Second data table:</t:div>
<t:dataTable id="myTable2" var="tableRow2" value="#{list2}">
<h:column>
<h:inputText id="rowInput2"
value="#{tableRow2}" />
<h:message for="rowInput2"
errorStyle="color:red"/>
</h:column>
</t:dataTable>
<h:commandButton value="submit" />
</h:form>
</f:view>
<managed-bean>
<managed-bean-name>list1</managed-bean-name>
<managed-bean-class>java.util.ArrayList</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
<list-entries>
<value-class>java.lang.String</value-class>
<value>Enter a String</value>
</list-entries>
</managed-bean>
<managed-bean>
<managed-bean-name>list2</managed-bean-name>
<managed-bean-class>java.util.ArrayList</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
<list-entries>
<value-class>java.lang.String</value-class>
<value>Enter a String</value>
</list-entries>
</managed-bean>
Enter something custom in first field
Enter "7" in second field as is (will cause a validation errror)
Enter something custom in third field
click submit button
The page is redisplayed because there is a validation error in second field
Second and third field have retained the entered values, but first field has
been reset.
First field should have retained its entered value as well.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira