Confirmation of Deletion

Confirmation of Deletion

This tip is an easy method to ask an user for confirmation before deleting any document in a Domino Web application. There is no straightforward way to ask for confirmation and delete the marked documents only from a view for applications on the Web. Hence, use a JavaScript confirmation box in the delete action. Update a field, say, DeleteConfirm field on the form to "yes" or "no". "Yes", if user presses "OK" on the confirmation box. "No" otherwise.

In the view, write the selection formula to include only those documents where DeleteConfirm field is not marked to "Yes". Run a scheduled agent on a view that that selects all the documents marked with DeleteConfirm field as "Yes" and use RemoveAll method to delete them.


Delete Documents agent:

Sub Initialize 
        Dim Session As New NotesSession 
        Dim db As NotesDatabase 
        Set db = Session.CurrentDatabase 
        Dim view As NotesView 
        Set view = db.GetView("DeleteDocuments") 
        Call view.Refresh       
        Dim collection As NotesDocumentcollection 
        Set collection = view.GetAlldocumentsbykey("Yes",True) 
        Call collection.RemoveAll(False) 
        
End Sub

Javascript for Delete Action button:

if (confirm("Are you sure you want to permanently delete this document?")) 
{ 
            alert("This document has been Deleted"); 
          document.forms[0].DeleteConfirm.value =

    Requires Free Membership to View

    Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.

    By submitting your registration information to SearchDomino.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchDomino.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

"Yes"; window.document.forms[0].submit(); } else { alert("This document is not being Deleted"); document.forms[0].DeleteConfirm.value = "No"; }

This was first published in March 2001

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.