Hello guys.
We have two field on form. One is combobox and one is DateTimeField. The data is bind with binder and we use readBean method.
Also we use this method: binder.bindInstanceFields(this)
to bind our fields to entity data (same name as properties in entity).
The form itself has 74 lines of code including import lines. Very simple form. Check attachments for visual presentation of the form.
Green button is save, and the white one is cancel button.
The binder listener for tracking user changes:
binder = new BeanValidationBinder<>(entityType);
binder.addValueChangeListener(e -> {
if (!settingBean) {
hasChanges = true;
}
});
binder.addStatusChangeListener(e -> {
if (!settingBean) {
hasChanges = true;
}
adjustResetButtonState();
adjustSaveButtonState();
});
Problem:
- When DateTimeField is binded with binder, the binder invoke listeners above event without user changing the data on form. Then on cancel button (because of fake changes) the user is prompt for losing the data.
- When we remove DateTimeField from form (no binding), the listeners work as expected (doesnt get invoked on cancel action). The prompt for changes does not shown because there was no changes on data.
We tested on 8.12.0, 8.12.1, 8.12.2.
Any idea what is wrong ? Maybe something internal changes in binder in recent versions ?
Thanks.