开发者

Is there an easy way to create a confirmation dialog using dojo-toolkit or spring-js?

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 f开发者_Python百科ar I didn't come up with a solution that suits such a simple and common use case.

Any hints?


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
}


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜