Search code examples
javascriptspring-bootvaadinvaadin-date-picker

Don't work the clear method in DatePicker when inputted invalid value


Don't work the clear method in DatePicker when inputted invalid value. I found mention of this bug in several articles https://github.com/vaadin/flow-components/issues/1696, but I can't find any solutions. I thought call "onClearButtonClick" function from js in java code. This function called when click in the clear button inside DatePicker.


Solution

  • https://github.com/vaadin/flow-components/issues/2176 mentions two potential workarounds also there is new comment in the original ticket suggesting to call datePicker.getElement().executeJs("this.inputElement.value = ''") from the Java code to forcefully clear the DatePicker.