Data change saved if tabbed out, not if clicked out

I have a method attached to the onDataChange event of a text field. The first thing the method does is calls databaseManager.saveData on the current record with evaluates as true. After that, I run a query that returns the value from the changed field. If I have tabbed out of the field, the value returned by the query is correct. If I exit the field any other way, like clicking on the background, the value appears to change, but the query returns the old value. Here is some of the code:

var vRecord = foundset.getRecord(foundset.getSelectedIndex());
var vSaveNoRecord = databaseManager.saveData();
var vSavevRecord = databaseManager.saveData(vRecord);
var vHasRecordChanges = databaseManager.hasRecordChanges(foundset,foundset.getSelectedIndex());

vSaveNoRecord and vSavevRecord always evaluate as true regardless if the user tabs or clicks out. vHasRecordChanges is true if the user clicks out, but false if the user tabs. Attached is a sample solution that illustrates this problem.

ODC_bug_sample.zip (3.74 KB)

can you open a case in our support system ?

I did right after I made this post. It is Case 283299.

SteveInLA:
I did right after I made this post. It is Case 283299.

This is not a bug because onDataChange is part of the saving process:

The onDataChange event is part of the saving process, it can stop a save if it returns false. So, the event is executed before the value is stored in database. In case of clicking away, the save will have no effect because clicking away is a save itself and we do not allow nested save. So, the real save will be done after the method is executed (as default part of Servoy). (This will be included in Servoy wiki as well)

Should use a workaround to get the desired behavior (I don’t see why should be able to read from database in onDataChange event, you have the values as parameters).