search StrictPatternDateConverter in the forum François
On Wed, Jul 3, 2013 at 12:21 PM, Jayakrishnan R <[email protected]> wrote: > Hi All, > > I have a DateTextField component in my application and I want the input of > date using a predefined pattern. The pattern that I need is "yyyy-MM-dd". I > created the DateTextField using the following code. > > DateTextField dtf_ExpiryDate = > DateTextField.forDatePattern("ExpDate", "yyyy-MM-dd"); > dtf_ExpiryDate.add(new DatePicker()); > > It helps to prevent date input in most of other formats. But it accepts > input in dd-MM-yyyy format and converts it into some weird format. For > example, *12-06-2013* is automatically converted to *0012-06-20*. > > Is there a way to throw an error when the date is given in dd-MM-yyyy ? > > Javadocs of DateTextField< > http://wicket.apache.org/apidocs/1.4/org/apache/wicket/datetime/markup/html/form/DateTextField.html > >says > that the conversion is done internally using the Joda time parser. Is > there a way to add more constraints ? > > I really don't want the data to be captured as String and add a > StringValidator to check if it confirms to the pattern using Regex. > > Thank you > > -- > Thanks & Regards > JK >
