myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leonardo Uribe <lu4...@gmail.com>
Subject Re: String value instead of Date
Date Mon, 16 Mar 2009 23:53:21 GMT
Hi

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.

regards

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" />
> </t:inputCalendar>
>
> 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?
>
> Thanks,
> Markus
>

Mime
View raw message