Alert dialog box

From Wikipedia, the free encyclopedia

An alert dialog is a colloquial (though commonly accepted technical) term for a particular type of dialog box that occurs in a graphical user interface. It is also known as an alert box, alert window, or alert popup.

[edit] Intended use

Alerts were designed for two main uses. The first is to inform the user than an operation could not continue or complete due to some insurmountable error. The second is to warn them that the current course of action could be in some way dangerous or detrimental, and to offer the option of not proceeding.

Due to the simplicity of generating an alert box, especially in comparison with other popup methods, alert boxes are often heavily used in amateur web applications for providing information and notifications that are not the result of errors or failures.

[edit] Misuse

Due to the ease in which a dialog window can be presented to the user, especially in modern web pages using a very simple JavaScript function, alert dialogs are often used for matters that do not reflect a functional error or potentially dangerous course of action, but instead to provide the user with the results of a successful operation, or simply to greet the user with a custom message.

Possibly the most common form of alert abuse is presenting an alert to the user when the user has entered invalid information for one of the values in an input form. Some example of user input errors that might trigger an alert dialog are: entering a date that does not exist (e.g. "February 30"), using letters in a field that should represent a quantity (number), not providing a required value, or providing a value that is outside the range of the program's capabilities (such as from arithmetic overflow). Use of an alert box to present problems with user input can be minimized by performing sanity checks on input values.

The typical alert dialog provides only one option; to close the window. Closing an alert dialog will provide access to the original screen, which is not available while the alert dialog is presented.

[edit] Example

alert() is the name of the method used in JavaScript to spawn an alert dialog. The argument to the method is the text to be displayed in the window.

A dialog created this way will contain a yellow triangle warning symbol (similar to those found on electrical devices), the text of the warning message, and a single button saying "OK" which will close the window.

Such a dialog also assumes control over the user interface, preventing the user from proceeding with any other task in the application until the dialog window is closed.

Used along with a technique to execute it in a web page, the following JavaScript code:

alert('This alert dialog tells you something important.');

will create the following alert dialog (when viewed with Mozilla running on Windows XP):

Image:JavaScript_Alert_Dialog.PNG