+

Search Tips   |   Advanced Search

Display messages in the status bar module


Displaying messages in the status bar module.

All ready-to-use theme profiles include the status_bar module, which provides an area beneath the header for displaying error, warning and information messages. The following image shows an example error message in red.

  1. Add a line of JavaScript to Use this status bar in your themes, modules, and portlets can use this status bar. The following is a sample of the StatusMessage JavaScript code:
    i$.fireEvent("/portal/status",[{message: new com.ibm.widgets.StatusMessage
    ("error", "The specified name is in use. Please enter a unique name.", ""), uid: 'ibmStatusBox'}]);
    
    i$.fireEvent is the recommended syntax. However, if we use the Dojo module, we can also use this alternative syntax:
    dojo.publish("/portal/status",[{message: new com.ibm.widgets.StatusMessage
    ("error", "The specified name is in use. Please enter a unique name.", ""), uid: 'ibmStatusBox'}]);
    

    1. The first argument in the StatusMessage can be either "error", "warning" or "info" to control the icon and color of the message box.

    2. The second argument in the StatusMessage is a String representing the message itself to be displayed in the message box.

    3. The third argument in the StatusMessage is an optional String representing any further details about the message. The details are not presented to the user by default, rather only if the user clicks the Show Details icon to expand the message box.

  2. If you have an erron that originates on the server, we can set a ibm.portal.operations.error cookie in the response, and the client shows the message when the response completes. Use parsable JSON code for the cookie string value, such as:
    ibm.portal.operations.error={"errorType":"error","errorMessage":"The specified name is in use. Please enter a unique name.","errorDetails":""}
    


Parent: Customize the theme