If you use a validator like t:validateRegExpr, you assume the value to be saved on the bean is a String, instead a Date. To make this work you have to implement a custom converter that implements org.apache.myfaces.custom.calendar.HtmlCalendarRenderer.DateConverter. In this case, converter.getAsObject return a String but converter.getAsDate returns a Date instance used to show on the calendar during encodeEnd.


Leonardo Uribe

On Tue, Feb 24, 2009 at 4:06 PM, Markus Mehrwald <mmehrwald@gmx.at> wrote:
Hi all,

I have the following code:

<t:inputCalendar renderAsPopup="true" renderPopupButtonAsImage="true"
       value="#{registrationData.userToEdit.birthDate}" id="birthdate"
       required="true" popupDateFormat="dd.MM.yyyy"                                    helpText="TT.MM.JJJJ">
       <t:validateRegExpr                                                               pattern="^([0-3]?\d)\.([0-1]?\d)\.((\d){2}|(\d){4})$"                    detailMessage="TT.MM.JJJJ eingeben."/>
       <f:validator validatorId="birthdateValidator" />
       <a4j:support reRender="birthdateP" event="onblur"                                       ajaxSingle="true" />

The problem is, that the regexpr validator does not work because it gets the String vom the Date's toString and this is not what is shown in the textfield. Do I have any possibility to get the text which is shown in the textfield for the validator?