views:

516

answers:

2

Hi,

In my spring webapplicaiton I would like the user to confirm the deletion of an item before actually do it. I've looked for a simple example using dojo, but so far I didn't come up with a solution that suits such a simple and common use case.

Any hints?

+1  A: 

JavaScript has a built-in confirmation dialog that cannot get any simpler. It takes one argument, the message to display and returns true or false, matching the user's choice

if( confirm("Do you really want to delete this?" ) {
    // delete it!
}
else {
    // don't delete it
}
Donal Boyle
Oops. Should have researched this. The only dialog in js I knew so far was good old alert. ;-) Thanks!
er4z0r
+1  A: 

confirm is definitely the simplest way to do it, but it uses native controls. If you want to control the look and feel, you can use dijit.Dialog. One example can be found here, and it seems likely there will be some addition to the toolkit soon.

peller
Thanks for your reply. But Dnal Boyle gets the cookies ;-) He was faster.
er4z0r