cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: Validating fd:fields with datatype base="date"
Date Thu, 01 Jul 2004 21:46:12 GMT
On 01.07.2004 21:13, Colin Paul Adams wrote:
> I have a widget defined with a base datatype of date. I have the
> calendar pop-up attached so that the user can enter dates easily.
> 
> However, if the users types in a date by hand, and gets it wrong, the
> rather unhelpful error message is:
> 
> datatype.conversion faileddatatype.date
> 
> Fine for developers whilst writing the application but ...

This should be handled by i18n. When I try the flow sample I get a 
message "Not a valid date."

> Even worse, if the user types in nothing (on a freshly added row), the
> form accepts this without complaint (I'm not quite sure why this
> should be - I have a pattern convertor and the empty string doesn't
> match the pattern - well, I don't think it does:

If you do not enter anything no convertor is asked. That's an expected 
behaviour. If you want to make a required field, add required="true". If 
the behaviour were like you expect it, it would not be possible to leave 
out a date field.

> Anyway, clearly I need a validator so I can give appropriate error
> messages. Looking at the documentation, there does not appear to be
> one available for date fields. Does that mean I have to write one in
> javascript (or will I need to use java?)?

No, required="true", the convertor with a pattern and an i18n message 
should be sufficient.

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message