You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Anne-Julia <an...@googlemail.com> on 2006/10/18 18:40:07 UTC
inputCalendar doesn't give the value to the bean
Now I have the following setup:
MyFaces 1.1.5-snapshot
tomahawk-sandbox-1.1.5-SNAPSHOT
tomahawk-1.1.5-SNAPSHOT
When I want to save the Bean-Objekt to the DB the t:inputCalendar didn't
give the value of the chosen date to the bean. Instead the value ist still
NULL.
I wrote my own validator.
Here is the code:
<t:inputCalendar
renderAsPopup="true"
renderPopupButtonAsImage="true"
readonly="true"
required="true"
disabled="#{!packi.enabled}"
monthYearRowClass="yearMonthHeader"
weekRowClass="weekHeader"
currentDayCellClass="currentDayCell"
value="#{packi.curDate}"
validator="#{packi.validateDate}">
</t:inputCalendar>
public Date getCurDate() {
return curDate;
}
public void setCurDate( Date curDate) {
this.curDate = curDate;
public void validateDate(FacesContext context, UIComponent toValidate,
Object value) {
boolean isValid = true;
this.curDate = (Date)value;
if(this.idHop>-1) {
isValid = factory.validateDate(this);
if (!isValid) {
FacesMessage message = new FacesMessage("Validierungsfehler:
" ,"Datum befindet sich nicht im Zeitraum der Etappe!");
context.addMessage(toValidate.getClientId(context),
message);
}
}
((UIInput)toValidate).setValid(isValid);
}
Please help.