Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
How to handle conversion error in DateField
Hi,
I have some problems using the DateField. If the user enters an invalid datestring in the textbox of the DateField, an ConversionException is thrown and a "!" with the exception tooltip is rendered to the caption of the Datefield.
But this errorindicator still remains even if the user enters a valid datestring or selects a date from the popup.
what is the preferred way to handle this error.
I know i can add an errorHandler to the datefield, and i can subclass the datefield and override the handleUnparsableDateString method.
what do i have to do to :
1.) Display a userreadable error message in the component
2.) delete the errormessage if a valid date is entered
3.) I think this is not possible: display the wrong entered value in the textfield of the datefield
One last question: How can you controll the dateformat of the component. is setting the locale the only way doing this ?
thanks
Jan
Jan Viaccava: One last question: How can you controll the dateformat of the component. is setting the locale the only way doing this ?
Use DateField.setDateFormat(String), that should do it.