Confirmation dialog on deleting...

1,882 views
Skip to first unread message

Nicu Marcu

unread,
Oct 2, 2009, 2:23:06 AM10/2/09
to django...@googlegroups.com
Hello all,

    I search over the net, but I don't find how can do this. I need to pop up a dialog with: "Are you sure to delete this?" every time when I want to delete a row from a list, etc. Can you tell me where I found an exemple or some documentation, or how to pop up a dialog box in Django.

--
All the best,

Nicolae MARCU

Marcelo Criscuolo (Jaú)

unread,
Oct 2, 2009, 8:54:31 AM10/2/09
to django...@googlegroups.com
I think you'll need some Javascript. Try jQuery:
http://jqueryui.com/demos/dialog/#modal-confirmation.
--
http://www.diptera.com.br

Tim Chase

unread,
Oct 2, 2009, 9:24:40 AM10/2/09
to django...@googlegroups.com
> I search over the net, but I don't find how can do this. I
> need to pop up a dialog with: "Are you sure to delete this?"
> every time when I want to delete a row from a list, etc. Can
> you tell me where I found an exemple or some documentation, or
> how to pop up a dialog box in Django.

The two ways to do this are (1) a JavaScript confirmation on your
form's "Delete this" submit button or (2) expect an extra
parameter to your POST that, if not set, rerenders the page
prompts them if they really want to delete it (so that
re-submitting the deletion POST now has the requisite
confirmation information).

The problem with #1 is that if the user has JS disabled, they
don't get the confirmation.

The problem with #2 is that it requires an extra round-trip to
the server.

You can combine both methods so that if they have JS enabled, the
confirmation will add the confirmation field to the submitted
form data, and fall back to #2 if they don't.

-tim

PS: there's really no need to post the same question twice in
3hr...especially when it happens to fall within 1:00am-4:00am
CST/CDT time period (plus or minus, adjusted for time-zone).
Patience of at least half a day would be nice.

Reply all
Reply to author
Forward
0 new messages