You are here: When to Use an Alert

Alert Widget

Using the Alert widget, you can display information (Notifications, Advertisements, Confirmations, Error messages, Reminders), or request users to perform tasks (compliance tasks, make payments, provide feedback, etc.).

You can configure the alert in a way that the user must perform an action before proceeding to use the application (Modal). You can also use JavaScript functions to define the Yes or No buttons in an alert to allow the user to choose an action for the alert that appears. You can customize the skin, title, and icon for an alert.

The Alert widget capabilities can be broadly categorized into the following:

Data Management

 
PropertiesDescription
alertTitle Specifies the Title of the alert.
message Specifies the message description of the alert to be displayed.
 

Enabling RTL

PropertiesDescription
retainContentAlignmentHelps to retain the content alignment of the widget while applying RTL.
retainFlexPositionPropertiesHelps to retain the left, right and padding properties while applying RTL.
retainFlowHorizontalAlignmentEnables you to change the horizontal flow of the widget from left to right.

Miscellaneous

MethodsDescription
dismissAlert Used to dismiss an alert.
 
EventsDescription
alertHandler Specifies the JavaScript function that should get called when alert is dismissed either through "Yes" button or through "No" button.
 
PropertiesDescription
accessibilityConfig Enables you to control accessibility behavior and alternative text for the widget.
alertIcon Specifies the Icon to be displayed to visually indicate the type of alert.
alertType Specifies the Type of the alert window to be displayed.
cursorTypeSpecifies the type of mouse pointer used.
noLabel Specifies the descriptive Text for the "No" label.
yesLabel Specifies the descriptive Text for the "Yes" label.
textOverflow Specifies whether text wrapping is enabled below the image when the text message is more than image height.

Alert Widget Basics

When to Use an Alert

You can use an Alert in many situations, some of them are:

  1. If you want to warn the user about something, for example, "You will now be redirected to the xyz website, Press Yes to proceed and No to cancel".
  2. An error has occurred and you want to inform the user. For example, if the user enters incorrect password.
  3. To inform the user about a transaction is completed successfully.

Creating an Alert Using a Constructor: kony.ui.Alert

Example


var alert = kony.ui.Alert(basicConfigs, pspConfigs);

Note: In all native implementations alert is non blocking. Which means execution of logic (placed after the alert creation) will not wait for the alert confirmation but execution continues. In case of SPA, thin client platforms, it is always blocking the execution until user clicks either "yes" label button or "no" label button.

Note: Currently creating kony.ui.Alert itself will show the alert and end user has to respond to it. Alert Handle returned is not of any use but in future there is possibility of allowing the developers to show, dismiss the alert programmatically through this handle.

Note: The configuration properties should be passed only in the respective configuration objects otherwise they are ignored

Example

//Creating the alert with the alertIcon:"icon.png"
var alertBasic = {
    message: "Kony Alert",
    alertIcon: "icon.png"
};

var alertPSP = {};

var alert = kony.ui.Alert(alertBasic, alertPSP);

premCopyright © 2012 Kony, Inc. All rights reserved.
premCopyright © 2012 Kony, Inc. All rights reserved.