Bug: calendar month refreshing and validation
akira_ag Sep 1, 2007 4:58 AMI think that found the next bug.
If a user change month in the calendar control, that validation error for selectOneMenu is shown.
I don't know which component is affected, but the following example illustrate this bug:
file: test-calendar.jsp
<?xml version='1.0' encoding='utf-8'?>
<jsp:root xmlns="http://www.w3.org/1999/xhtml"
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
<f:view>
<html>
<jsp:output
doctype-root-element="html"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
<jsp:directive.page contentType="text/html;charset=utf-8"/>
<head>
<title>Bug example / calendar</title>
</head>
<body>
<h:form id="TestForm">
<h:inputText id="testText" value = "#{MySessionBean.testText}" required="true"/>
<br/>
<h:selectOneMenu
id="testSelect"
value="#{MySessionBean.testSelect}"
required="true">
<f:selectItems value="#{MySessionBean.testSelectItems}" />
</h:selectOneMenu>
<br/>
<rich:calendar
id="calendarDate"
value="#{MySessionBean.testDate}"
popup="false"
datePattern="d MMM, yyyy"
required="true"/>
<br/>
<h:commandButton value="Submit"/>
</h:form>
<a4j:outputPanel id="TimelineTablePanel" ajaxRendered="true">
<h:messages showDetail="true" />
</a4j:outputPanel>
</body>
</html>
</f:view>
</jsp:root>
file: MySessionBean.java
package test.checkbugs;
import java.util.Date;
import java.util.Collection;
import java.util.LinkedList;
import javax.faces.model.SelectItem;
public class MySessionBean {
private String testText;
private Date testDate = new Date();
private String testSelect;
public static class MyItem {
private Integer id;
public MyItem() {};
public MyItem(Integer val) {
this.id = val;
};
public void setId(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
}
private Collection<MyItem> myCollection;
public MySessionBean() {
showDataTable();
}
public String showDataTable() {
setMyCollection(new LinkedList<MyItem> ());
for(int i=0;i<20;i++)
myCollection.add(new MyItem(i));
return "success";
}
public void setMyCollection(Collection<MyItem> myCollection) {
this.myCollection = myCollection;
}
public Collection<MyItem> getMyCollection() {
return myCollection;
}
public String goToId() {
myCollection.clear();
return "success";
}
public void setTestText(String testText) {
this.testText = testText;
}
public String getTestText() {
return testText;
}
public void setTestDate(Date testDate) {
this.testDate = testDate;
}
public Date getTestDate() {
return testDate;
}
public void setTestSelect(String testSelect) {
this.testSelect = testSelect;
}
public String getTestSelect() {
return testSelect;
}
public Collection<SelectItem> getTestSelectItems() {
Collection<SelectItem> result = new LinkedList<SelectItem>();
for ( MyItem item: myCollection) {
result.add ( new SelectItem(item.getId(),item.toString()) );
}
return result;
}
}
POST AJAXREQUEST dump:
AJAXREQUEST=j_id_id2&TestForm=TestForm&TestForm%3AcalendarDateInputDate=1%20%D1%81%D0%B5%D0%BD%2C%202007&TestForm%3AcalendarDateInputCurrentDate=06%2F2007&javax.faces.ViewState=_id1&TestForm%3AcalendarDateDateScroll=06%2F2007&F