andersonfreitas / vaadin-masked-textfield

A MaskedTextfield for Vaadin
http://vaadin.com/addon/maskedtextfield
Apache License 2.0
13 stars 24 forks source link

focusing away from the component clears the textfield #25

Open mvysny opened 7 years ago

mvysny commented 7 years ago

When the focus is removed from the MaskedTextField, the field itself is cleared. This hurts the user experience if there are multiple masked text fields in the form and the user wishes to fill them only partially. Compared to Vaadin TextField, the value is not erased even though the new value is invalid and doesn't pass through Validators.

mvysny commented 7 years ago

The code in question:

    @Override
    public void onBlur(BlurEvent event) {
        if(isFieldIfIncomplete()) {
            cleanText();
        } else {
            super.onBlur(event);
        }
    }