You should set the type to Date by either using the appropriate
constructor or by calling setType.
Eelco
On Jan 8, 2008 10:16 PM, Marco Aurélio Silva <[EMAIL PROTECTED]> wrote:
> Wicket 1.2.6
>
> I'm using this code:
>
> RequiredTextField dateField = new RequiredTextField("dueDate", new
> PropertyModel (newsItem, "dueDate"));
> form.add(dateField);
> form.add(new DatePicker("dateFieldPicker", dateField));
>
> Anyway, I solved the problem creating a "SimpleDateValidator"
>
> public class SimpleDateValidator extends AbstractValidator {
>
> private static final long serialVersionUID = 1L;
>
> public void validate(FormComponent component) {
> DateConverter converter = new DateConverter(true);
> try {
> Object date =
> converter.convert(component.getModelObject(),Locale.getDefault());
> } catch (Exception e){
> error(component);
>
> }
> }
> }
>
>
> On Jan 8, 2008 12:11 PM, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> > What version of Wicket/ which component?
> >
> > Eelco
> >
> >
> > On Jan 8, 2008 9:34 PM, Marco Aurélio Silva <[EMAIL PROTECTED]> wrote:
> > > Hi
> > >
> > > I'm having problems with validation on a date field. Is there a easy
> > > way to validate user input on date fields? If user types a invalid
> > > date like "32-01-2008" I got a ConversionException:
> > >
> > > wicket.util.convert.ConversionException: Cannot parse '32-01-2008'
> > > using format [EMAIL PROTECTED]
> > > at
> > > wicket.util.convert.converters.AbstractConverter.newConversionException(AbstractConverter.java:72)
> > > at
> > > wicket.util.convert.converters.AbstractConverter.parse(AbstractConverter.java:52)
> > > at
> > > wicket.util.convert.converters.DateConverter.convert(DateConverter.java:73)
> > > at wicket.util.convert.Converter.convert(Converter.java:207)
> > >
> > >
> > > Thank you
> > > Marco
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]