I've had the same problem using java.text.DateFormat to validate the
same pattern you are using. The solution I use is to check the string
length to ensure that it is 10 characters. It might be nice if
PatternDateConverter were to be enhanced to have a required length value
to enforce this in an encapsulated manner, but it isn't required.


Larry

-----Original Message-----
From: damnitjim [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 25, 2008 2:03 PM
To: [email protected]
Subject: Strict 4 digit year for DateTextField?

Hi,
Has anyone been able to enforce that the year is 4 digits instead of two
for
the DateTextField? Right now, if my format is MM/dd/yyyy the
DateTextField
is still allowing two digit fields to be submitted.

final String dateFormat = "MM/dd/yyyy";
PatternDateConverter pdc = new PatternDateConverter( dateFormat, false
);
add(DateTextField.withConverter("obligationDate",  pdc));

I looked at the JODA javadoc for DateTimeFormat that
PatternDateConverter is
using but didn't see anything that would help (I saw ISODateTimeFormat
that
came close but it doesn't allow you to pass in the format).

This seems like a reasonably straight forward problem so what am I
missing?
Thanks!
Aye

_____________

The information contained in this message is proprietary and/or confidential. 
If you are not the 
intended recipient, please: (i) delete the message and all copies; (ii) do not 
disclose, 
distribute or use the message in any manner; and (iii) notify the sender 
immediately. In addition, 
please be aware that any message addressed to our domain is subject to 
archiving and review by 
persons other than the intended recipient. Thank you.
_____________

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to