I would like to react to invalid input into the DatePicker component, to do something along these lines:
datePicker.addInvalidChangeListener( e -> {
String input = //get current text in text field of datePicker
datePicker.setValue(getDateFromInput(input));
});
For that I would need access to the current content of the text field of the DatePicker, but I could not figure out a way to do it with the given API of DatePicker. Maybe there is something I am missing?
I have the same problem with 16.0.2. The user will type in an invalid date, e.g. ‘121220’ close the select dialog and go to the next input field. The invalid date-string remains visible. The user selects an other record with no date, which triggers a clear() on the datepicker. But that does not remove the invalid string-value, making the user believe that the value was saved. In the bug report they stated that the invalid-value was copied to all lines I don’t see a handle in the DatePicker where I can remove or prevent the invalid date-string. Perhaps I am missing something ? Any insight would be appreciated.
(On a side note, the ‘setAutoOpen(…)’ also seems to be missing in 16.0.2)