logo

Create a 'Delete Document' link

Place the following @Formula in to a Computed-Text hotspot (marked as Pass-Thru HTML) on a form in order to create a Delete action.

REM "Do not show delete link on a new document";
@If(@IsNewDoc; ""; "<a href=\"" + @Text(@DocumentUniqueID) + "?DeleteDocument\" onclick=\"return confirm(\'Are you sure you want to delete this document?\');\">Delete Document...</a>")


When clicked on the user gets prompted as to whether they really want to delete the document and then the URL is set to ?DeleteDocument which tells the server it should be deleted.

If you want to have control over the message returned then use the method described in this document.

Note: Domino can be quite particular about the view that is referenced in the URL. For example:

/dir/dbname.nsf/aView/DocumentID?OpenDocument

will open the document, irrespective of whether or not there is a view called "aView". However, the following will probably fail if the view does not exist.

/dir/dbname.nsf/aView/DocumentID?DeleteDocument

To get around this you may need to modify the URL so as to include the name of a view that does exist. Alternatively, if you are not sure, you could use the reserved name of "$defaultView". e.g:

/dir/dbname.nsf/$defaultView/DocumentID?DeleteDocument


Feedback

  1. Thanks!

    I know this article is fairly old, but I wanted to thank you and also share some additional things I used to add a dynamic redirect after deleting the document.

    I have a javascript function in my form to delete the current document which basically uses the info you gave in your article.

    function dodelete(redirect) { var confdel = confirm("Are you sure you want to delete this document?") if (confdel==true) {window.location = "/[dbname.nsf]/$$All/[@Text(@DocumentUniqueID)]?DeleteDocument&redirect=" + redirect};}

    I have a delete button on my form which calls the dodelete(<computed>) function with computed text as the argument so I can dynamically assign the redirect URL.

    Also, I have a Query_String field in my $$ReturnDocumentDeleted form, and I have some javascript to redirect that page to the url following the &redirect portion of the Query_String field.

    So far, it's been a huge hit with my web users.

  2. You can also use '0' as the viewname

    With the unique id of a document you can also use the link /<dbname>/0/<doc id>?Deletedocument

    1. Re: You can also use '0' as the viewname

      Using 0 and even $defaultView as the view name both fail on Release 6.5.5 FP2 with the error 'HTTP Web Server: Invalid URL Exception'. Create a view, use that in the URL and it works.

    • avatar
    • Daria
    • Wed 10 May 2006

    Deleting from a view?

    What about deleting from a view? I have a categorized view and the checkboxes are displayed next to each docuement. I want the users to be able to select the documents to be deleted and click on a Delete link from the view.

      • avatar
      • Jake
      • Wed 10 May 2006

      Re: Deleting from a view?

      Try this approach http://www.codestore.net/store.nsf/unid/EPSD-5GMT3B?OpenDocument

      Show the rest of this thread

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:



Navigate other articles in the category "Forms"

« Previous Article Next Article »
Common fields subform.   Effective use of the FileCloseWindow Command

About This Article

Author: Jake Howlett
Category: Forms
Keywords: Delete; confirm; link;

Options

Feedback
Print Friendly

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »