I'm not a huge fan of alert boxes, primarily because they do tend to mar the application's usability. As Alan Cooper said in About Face, it's tantamount to conking the user on the head and calling him/her an idiot.
Notification of bad data, on the other hand, is a critical need in an app. First and foremost, in my mind, you should attempt to prevent bad data from being entered whenever humanly possible. There are a variety of third party control toolkits for most platforms (ASP.NET, .NET WinForms, WPF, Java Swing, JSP, etc.) which will help with this. (Although it's not popular around these parts, I actually have grown partial to Infragistics NetAdvantage.)
Depending on your platform choice, you have many UI notification possibilities. Some have been mentioned: Using the status bar of your app, indicating an issue on the field itself, etc.
I'm a .NET guy, so obviously my input here will be flavored by the environment.
I'm a huge fan, on the web, of the validation controls. They provide a lot of the notification, without too intrusive a UI. Combining a simple Text
property of *
, a detailed ErrorMessage
property and a well-placing and visually obvious ValidationSummary
, I get all the validation with almost none of the user nightmares. These controls, for those not on .NET, perform a variety of validations against the entered data, and display their Text
properties wherever the control is on the page (usually next to the control being validated). The ErrorMessage
property goes in the one ValidationSummary
, usually located at the top of the page.
In the WinForms environment, I've taken to using a combination of the in-box ErrorProvider
control and Infragistics' Outlook-style pop-up boxes. In my most recent WinForms app, I use two different kinds of pop-ups: One is semi-translucent, and appears in the lower-right corner. It has a green check mark icon, and exists to notify the user of success messages. (My users don't trust computers; if they don't see some confirmation, they think the machine ate their data. Long story.) These boxes disappear in seven seconds, or the user may close them manually.
The second kind of pop-up has no translucency, a red X icon, and appears in the upper right. That's where I display validation errors. Additionally, the ErrorProvider
control displays an icon next to each field where validation failed, and hovering the mouse over a given control displays its specific error message. (These specific messages are also in the pop-up.) The error pop-ups disappear after fifteen seconds.
About the only modal alert boxes I use in that app are when it crashes (truly unhandled exceptions; which are currently near-impossible to do) and when the user wants to close a dirty window.
These are some of the techniques I've used to avoid alert boxes. The user can ignore confirmation messages (making their lives easier), and are not modally bothered by validation errors -- they can't save their data until those are fixed, but they're not being conked on the head. And of course, whenever possible, I prevent the validation errors by using appropriately-masked controls which do not allow invalid entry.