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.
Vaadin 8 and DateField component
DateField component behaves not as expected.
The Value of the component, defined in api is public T getValue().
Method public String getParseErrorMessage() returns defaultParseErrorMessage, when the component is empty or user entered invalid text.
Because of a TYPE SAFETY, i cannot decide whether the component`s getValue() is empty or user entered invalid string.
Method protected Result<T> handleUnparsableDateString(String dateString) doesn`t really help, because i want to validate datefield, when user clicks on a button, instead of loosing datefield`s focus, so i have set the errorHandler for component to null.
Can you implement something like isEnteredTextEmpty ?
I`ve also tried isEmpty, but with no luck (returns true, when the text is still there).
Thanks.
As a workaround, colleague had an idea to get String data from DateField component via Java reflection.
For people, facing the same problem:
public static String getStringDataFromDateField(DateField dateField) throws Exception {
Field field = null;
field = dateField.getClass().getSuperclass().getSuperclass().getDeclaredField("dateString");
field.setAccessible(true);
String dateString = (String) field.get(dateField);
field.setAccessible(false);
return dateString;
}