Anatomy of a Confirmation Box
See the source for a confirm box in action
Putting it to Use
With great knowledge comes great responsibility - or something like that. Basically, simply having the knowledge to make a website execute a particular action does not mean that we should implement that action at every opportunity. Quite the contrary, we need to be subtle and suave in our use of anything that will interrupt the user's process of perusing our website. One of the only acceptable times to use this method is when we need to actually confirm that the user wants to proceed with a requested action (such as submitting a form or deleting an item from a list). Let's look at a code sample for the latter:
Practical usage of a Confirmation Box
By glancing at this code sample, you can see how placing a confirmation box within the flow of logic, especially one triggered by a user induced event (such as a click or selection of some sort), is a great usage for this tool. We can easily give the user one last chance to opt out of a selected action and, as the name of the dialog suggests, simply confirm with them that they would like for the action to proceed. Providing such a check within your code can sometimes ease the user's mind and give them more confidence that they will not accidentally trigger something with undesired effects. Ease of use and practicality must be balanced in development, and using this confirmation box is a great way to assist with that.