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
Add your own response here:
Although your email address isn't required it is protected from spambots if you choose to provide it and not to hide it. My right to remove commercial, irrelevant or posts I just don't like is reserved.
Navigate other articles in the category "Forms"
| « Previous Article | Next Article » | |
| Common fields subform. | Effective use of the FileCloseWindow Command |
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.
Reply to this comment
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
Reply to this comment
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.
Reply to this comment
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.
Reply to this comment
Re: Deleting from a view?
Try this approach http://www.codestore.net/store.nsf/unid/EPSD-5GMT3B?OpenDocument
Reply to this comment
Show the rest of this thread