Ok, new insights on this issue: the date automatically gets corrected...
of course because the casting of the string to the Java date object does
that...
the question remains if it makes sense to auto-correct the date or if
any invalid date should raise an error, informing the user that
something isn't right (i.e. he entered "31.02.05" but meant "31.03.05".
the date gets auto corrected to "04.03.05" which is not at all what the
user wanted - and for business reasons... if such a "corrected but not
wanted" date is given, it might cause problems...).
I understand that the TypeValidator simply checks if Java can cast the
entered value into the given type... but for a date that might not be
the desired behavior... I know that the datePicker would be an option,
but I think that the datePicker only works with JavaScript enabled...
- Johannes
Johannes Fahrenkrug wrote:
Hi,
shouldn't the TextField, when you add a TypeValidator of type Date to
it, check if the entered date is valid?
I can enter the 31st of February, or even the 32nd.
And I have to set the Locale for the whole session in order for it to
accept the German date format. When I only pass a new Locale object to
the constructor of TypeValidator it doesn't work.
This is the code:
Locale locale_de = new Locale("de", "DE");
getSession().setLocale(locale_de);
add(new TextField("birthdate", new PropertyModel(person, "birthdate"),
Date.class).add(new TypeValidator(Date.class, locale_de)));
- Johannes
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle
Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing
& QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user