Strange behavior with rich:calendar
cbax007 Nov 2, 2007 11:25 AMI have a simple form on my page that contains a text input and a rich:calendar input. When the person leaves the text input field, via a4j:support, an action method is called to display a label next to the text input field. Now, this all works just fine when the rich:calendar is not set to required="true." But, when I set the calendar to required="true", the a4j event does not seem to fire any more. I have included the xhtml page and backing bean code below. Any thoughts on this strange behavior?
<html xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="https://ajax4jsf.dev.java.net/ajax" xmlns:rich="http://richfaces.ajax4jsf.org/rich"> <ui:composition> <h:form id="TestForm"> <table> <tr> <td align="right"> Code: </td> <td> <h:inputText id="Code" size="10" value="#{TestBean.code}"> <a4j:support event="onblur" action="#{TestBean.lookupDescription}" reRender="Desc"/> </h:inputText> <h:outputText id="Desc" value="#{TestBean.description}"/> </td> </tr> <tr> <td align="right"> Date: </td> <td> <rich:calendar popup="true" datePattern="MM/dd/yyyy" id="Date" zindex="2000" enableManualInput="true" required="true" value="#{TestBean.date}"/> </td> </tr> </table> </h:form> </ui:composition> </html>
import java.util.Date; public class TestBean { private Date date; private String code; private String description; public String lookupDescription(){ description = code + " Description"; return ""; } /** * Gets the code * @return String */ public String getCode() { return code; } /** * Sets the code * @param code The code to set. */ public void setCode(String code) { this.code = code; } /** * Gets the date * @return Date */ public Date getDate() { return date; } /** * Sets the date * @param date The date to set. */ public void setDate(Date date) { this.date = date; } /** * Gets the description * @return String */ public String getDescription() { return description; } /** * Sets the description * @param description The description to set. */ public void setDescription(String description) { this.description = description; } }