Lary,
I've been looking at the APIs some more and found this different
DateTextField (I'm not sure which one you're using):
org.apache.wicket.extensions.markup.html.form.DateTextField
I was using this one:
org.apache.wicket.datetime.markup.html.form.DateTextField
It looks like the the one in the extensions package supports passing in
SimpleDateFormat but you're saying that it might also have issues. I'll try
it and see. Thanks bud!
On Mon, Jul 28, 2008 at 8:52 AM, Zappaterrini, Larry <
[EMAIL PROTECTED]> wrote:
> Aye,
>
> The use of DateFormat is actually in Spring's CustomDateEditor object.
> See
> http://static.springframework.org/spring/docs/2.5.x/api/org/springframew
> ork/beans/propertyeditors/CustomDateEditor.html#CustomDateEditor(java.te
> xt.DateFormat,%20boolean,%20int)<http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/beans/propertyeditors/CustomDateEditor.html#CustomDateEditor%28java.text.DateFormat,%20boolean,%20int%29>where
> it mentions that
> setLenient(false) does not enforce strict parsing as you might expect. I
> think you are correct in thinking that creating your own IConverter
> would be the best solution. I'd probably give subclassing
> PatternDateConverter a shot.
>
> Larry
>
> -----Original Message-----
> From: damnitjim [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 28, 2008 11:43 AM
> To: [email protected]
> Subject: Re: Strict 4 digit year for DateTextField?
>
> Larry,
> I think setLenient(false) should work if you use java.text.DateFormat
> but
> did you write your own custom implementation of IConverter interface?
> Thats
> the only way I can think of at this point.
> Aye
>
> On Fri, Jul 25, 2008 at 2:25 PM, Zappaterrini, Larry <
> [EMAIL PROTECTED]> wrote:
>
> > 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]
> >
> >
>
> _____________
>
> 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]
>
>