Adds a callback that is invoked when a field or control is focused or blurred.


Name Type Description
objname String The name of the field or control to find.
callback Function The function to be invoked when the field or control is focused or blurred.
focus Boolean Whether to invoke the callback when the field or control is focused or blurred.

Return Value

Result Value


This example registers a named function to be called when a field is focused or blurred:

function customFocusCallback()
    if ( IsFieldEmpty( "Description" ) )
         ShowErrorDiv( true, "A description is required" );
         ShowErrorDiv( false );
AddFocusCallback( "Description", customFocusCallback, false );


Callbacks are invoked in the order in which they are added. This callback can be used to perform validation or other data verification. If you want to display a field validation error, call MakeFieldInvalid from this callback so that any required or invalid field errors are automatically processed.

This method can be used with all field types and all input controls. For Multi-Selection, Multi-Relational, Multi-User, and Multi-Group fields, with the "Allow searching" field style, the focus or blur must occur on the right-hand side of the list box.