Cross field validations bounded in an unbuffered mode

Hello

I have 2 date fields bounded to fieldGroup which is in an unbuffered mode.
I’ve added a validator for 2 date fields (from date < to date) and also a value change listener (which marks other dependent property as dirty).

Problem is:
Current state: 2 date fields are valid (Eg: from/to - 12Jan2016/12Jan2017)

  • I change 1st date field to 12Oct2017. Here the 2 fields are marked as invalid and validator prevents the field to be written back.
  • Next i change 2nd date field as 12Nov2017. Validation succeeds and 2nd field is written back to attached data source.
  • But the 1st field is still not committed to datasource (although this is valid now). This field will be committed only if i again change this 1st field value.

Is there any possibility for committing both the fields to property data source when in unbuffered mode.

Thanks for you help/support in advance.


My code snippet follows:


Adding validator to both the fields:

binder.addSpecificPropertyValidators(new String { “dateFrom”, “dateTo” },
new CustomValidator(binder.getField(“dateFrom”), binder.getField(“dateTo”), true));


Adding listeners

public void addDateFieldValidatorValueChangeListeners(String listenerProperty, final String dependentProperty) {
// Add value change listener to ‘listenerProperty’ field to mark ‘dependentProperty’
// fields as dirty.
addValueChangeListener(listenerProperty, new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
getField(dependentProperty).markAsDirty();
}
});
}

Can you share the whole test code? for example, a Github link? It would be much easier to debug.

Without seeing the entire code, just guessing, will it work by changing

getField(dependentProperty).markAsDirty(); to

getField(dependentProperty).commit(); ?