Show TOC

UI MessagesLocate this document in the navigation structure

UI messages reference a control. They are handled and processed by the control message processor and are propagated to the message manager.

The most common example for UI messages are validation messages. Validation messages are generated in the validation type of the data binding. If a bound property has an assigned type, the validation can trigger the message creation. To activate the automatic message creation, the following options exist:

  • Component:

    You can activate the automatic message generation in the component metadata or as a parameter when instantiating the component as follows:

    sap.ui.core.UIComponent.extend("MyComponent", {
        metadata  : {
            version  : "1.0" ,
            handleValidation  : true,
    var oComponentContainer = new sap.ui.core.ComponentContainer("MyComponentContainer", {
        name: "MyComponent",
        id: "myComponentId",
        handleValidation: true,
  • Control

    You can activate automatic message generation for controls by registering the control in the message manager as follows:

    var oInput = new sap.m.Input({
        value: { path: "/Products(1)/Price", type: new sap.ui.model.type.Float () }
    sap.ui.getCore().getMessageManager().registerObject(oInput, true);
Creating UI Messages

You can also create UI messages manually and add them to the message manager. If you add the message to a control property that is also validated, your message is deleted when new validation results for that property come in. You can override this behavior by setting the persistent property of the message to true.

var oMessageProcessor = new sap.ui.core.message.ControlMessageProcessor();
var oMessageManager  = sap.ui.getCore().getMessageManager();


var oInput = new sap.m.Input({
    id: "myInputId",
    value: { path: "/Products(1)/Price" , type: new sap.ui.model.type.Float() }

    new sap.ui.core.message.Message({
        message: "ZIP codes must have at least 23 digits",
        type: sap.ui.core.MessageType.Error,
        target: "/myInputId/value",
        processor: oMessageProcessor

The target of a UI message can be empty. In this case, the UI message has no specific target and is relevant for the whole application. If a target is set, the target is a string consisting of a control ID, a slash ("/"), and the name of the property to which the message applies.

Example: label0/text