onFocusLost() Question

Version: 5.1.2 - build 959

I am trying to validate a field when focus is lost and am having some difficulties. The field I want to validate is attached to a global variable as the dataprovider. It appears that the onFocusLost() method for this field is firing before the dataprovider is updated…is this the expected result? Should it not be the other way around?

The first line of code in onFocusLost() displays the field’s dataprovider value. If the field contains some initial value that is changed, and the tab key is pressed to exit the field, onFocusLost() displays the old value. If the cursor is placed in the field a second time (not changing the field contents), and the tab key is pressed, then onFocusLost() displays the new value.

This is a problem, since the validation needs to work with the changed value the first time focus is lost. Unlike onDataChange() where the ‘oldvalue’ and ‘newvalue’ of the field are passed along with the ‘event’ value, onFocusLost() only passes the ‘event’ value, so the dataprovider must have the correct value when onFocusLost() fires.

function onFocusLostTestValue( event )
{
    plugins.dialogs.showInfoDialog( 'DEBUG', globals.testValue, 'OK' )
    
    return true
}

Thanks!

for data validation dont use onFocusLost but use onDataChange.