cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Refondini <>
Subject Re: CFORMS: Accept Multiple Date Formats
Date Wed, 31 May 2006 22:47:37 GMT
Daniel Curran wrote:
> I have a date field in my form definition setup as:
> <fd:field id="dscdate">
>  <fd:datatype base="date">
>    <fd:convertor type="formatting">
>      <fd:patterns>
>        <fd:pattern>MM-dd-yyyy</fd:pattern>
>        <fd:pattern>MM/dd/yyyy</fd:pattern>
>      </fd:patterns>
>    </fd:datatype>
> </fd:field>
> When a user enters a date such as 10-20-2005 a failure is the result, 
> with the form generating a validation message. When entering the date as 
> 10/20/2005 the submission is successful. Is it possible to accept both 
> these formats? If so how should this be setup?
> Thanks,
> Dan

Hi Daniel,
The only way I know to have "multiple" patterns is with locale:

<fd:convertor type="formatting">
     <fd:pattern locale="nl-BE">dd/MM/yyyy</fd:pattern>
     <fd:pattern locale="fr">dd-MM-yyyy</fd:pattern>

Example taken from:

But this won't allow two "active" patterns at the same time which seems 
to be what you're after.

You might also consider using aggregated fields, see (click "switch" 

Just hints,


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message