cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Portier <...@outerthought.org>
Subject Re: [Woody] wd:datatype base="date" -> setLenient(false) behavior
Date Mon, 22 Dec 2003 11:14:03 GMT
Taking it to dev since we should have some consensus on changes like 
these IMHO.


Markus Heussen wrote:

> If the input of the date form field is for example "31.02.2004" after
> submission this value is automatically set to "02.03.2004".
> 
> How can I change this behavior? Is there a attribute I can set in the woody
> binding or definition file to get the behavior like using the
> "setLenient(false)" method in java?
> 
> Thanks for your help!
> 
> Markus
> 

Markus,

I think you correctly identified the source of your problems here: the 
standard date-conversion is done using the java.util.text stuff which is 
by default lenient towards typos of the kind you describe (31/02 
automatically becomes 02/03)

Possible options out I see:
1/ call setLenient(false) in the code so we avoid the surprises 
introduced by the default behaviour of the Java classes (although that 
might surprise the java-savvy)

2/ provide a wd:pattern/@lenient to let it be user-defined (in which 
case we still need some choice for the default)

other suggestions?

-marc=


> 
> woody defintion:
> 
> <wd:field id="vn_geburtsdatum" required="true">
> 	<wd:label>Geburtsdatum</wd:label>
> 	<wd:datatype base="date">
> 		<wd:convertor>
> 			<wd:patterns>
> 				<wd:pattern>dd.MM.yyyy</wd:pattern>
> 			</wd:patterns>
> 		</wd:convertor>
> 	</wd:datatype>
> </wd:field>
> 
> 
> woody binding:
> 
> <wb:value id="vn_geburtsdatum" path="v:Geburtsdatum">
> 	<wd:convertor datatype="date" type="formatting">
> 		<wd:patterns>
> 			<wd:pattern>yyyy-MM-dd</wd:pattern>
> 		</wd:patterns>
> 	</wd:convertor>
> </wb:value>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 

-- 
Marc Portier                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                http://blogs.cocoondev.org/mpo/
mpo@outerthought.org                              mpo@apache.org


Mime
View raw message