Create a 'Delete Document' link

Jake Howlett, 2 January 2001

Category: Forms; Keywords: Delete confirm 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