Show TOC

Declarative Support: EventsLocate this document in the navigation structure

The value of the event data attribute contains the name of a JavaScript function which will be used as callback once the event has been triggered.

The following code snippet gives an example how a change of TextField results in an alert with its new value when the focus is lost:

<script>
  function handleChange (oEvent) {
    alert (oEvent.getSource().getValue());
  }
</script>

<div data-sap-ui-type="sap.ui.commons.TextField" data-value="Change me!" data-change="handleChange"></div>

Currently, SAPUI5 only supports to specify the name of a callback function. You can define callback functions within any class, see the following code example:

<div data-sap-ui-type="sap.ui.commons.TextField" data-value="Change me!" data-change= "my.company.MyClass.handleChange"></div>