cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Merico Raffaele <>
Subject AW: cform date validation
Date Fri, 09 Dec 2005 08:31:21 GMT
Ciao Derek, ciao Gunter

Thanks a lot for your hints. I - nearly - solved the problem with
<fd:javascript/> based on the javascript library of 

The javascript code refered in the <fd:javascript/> looks very simple:

var enteredValue = cocoon.request.get(widget.getRequestParameterName());
var trimedValue = enteredValue.replaceAll("\\s", "");
if (!isDate(trimedValue, "d.M.yyyy")) {
		var valError = new
		return false;

The only unsolved problem is that a "wrong" date input (i.e. 32.12.05) is
auto-converted and redisplay as 01.01.06. As this point the users sees an
error message with a right date. But he does not see what he entered before.

I see, if not differently possible, the possibility to display the original
entered date as part of the error message. Not a very elegant solution. What
I am looking for is a possibility to set the originally entered date and to
be redisplayed as the user typed it in.

Any ideas ... Raffaele

PS: An alternative (not really) could be the use of the datatype string
instead of the datatype date. But in this case I see some problems in the
conversion/presentation of given form data (coming from the source)
formatted as yyyy-MM-dd and therefore not conforming to the locale

> Another insight from another mailing list:
> You could also implement a pattern match range check on
> your input field, using cform functionality, without resorting to JS.
> see:
> http://localhost:8080/cocoon/docs/userdocs/forms/validation.html
> ( fd:range, or fd:regexp or even fd:javascript)
> I would think there must be on-line examples of date expressions?
> >>> 2005/12/07 11:18 AM >>>
> have the same issue with cocoon 2.1.4 and apparrently the java.util.Date
> class accepts this (as far as I know) so the only thing that you can do
> (as what I did) is to implement a clientside date validation; you can find
> plenty examples on the net but if you want I can easily drop one here
> Gunter
> Merico Raffaele < >
> 07/12/2005 10:13
> Please respond to
> To
> cc
> Subject
> cform date validation
> Dear community
> I have a strange effect with cform date fields. Values like 32.12.2005 or
> 29.2.2005 are automatically corrected to 1.1.2006 or 1.3.2005 without any
> validation error. What can I do to let the cform validation service
> declare such dates as incorrect?
> For your support many thanks in advance ... Raffaele
> --
> This message is subject to the CSIR's copyright, terms and conditions and
> e-mail legal notice. Views expressed herein do not necessarily represent
> the
> views of the CSIR.
> CSIR E-mail Legal Notice
> CSIR Copyright, Terms and Conditions
> For electronic copies of the CSIR Copyright, Terms and Conditions and the
> Legal Notice send a blank message with REQUEST LEGAL in the subject line
> to
> This message has been scanned for viruses and dangerous content by
> MailScanner,
> and is believed to be clean.  MailScanner thanks Transtec Computers for
> their support.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message