Manage Learn to apply best practices and optimize your operations.

Delete current document on the Web - another method

Delete current document on the Web - another method

I came up with this method to allow a clean delete on the web. It uses JavaScript to confirm the desire to delete and the $$ReturnDocumentDeleted form. It opens a new window to hold the results of the delete.

Keywords: Delete, Deleting, documents, WEB

1. Create the $$ReturnDocumentDeleted form. There is only one requirement if you only use this method for deleting documents. Enter "close();" in the onLoad event for the form.

2. Use the following JavaScript function to perform the delete either by defining it in the form' JS Header section or as the action itself:

 function deleteDoc(){ if(confirm("Are you sure you want to DELETE? click 'OK' to delete or 'Cancel' to abort")){ var href = window.location.href.toLowerCase(); href = href.replace(/editdocument/,"DeleteDocument"); NewWindow =,"","left=100,top=100,width=300,height=100",true); window.location.replace(window.parent.LastViewViewed); } }

If you define the function in the JS Header or other location, simply call the deleteDoc() function using an action javascript call. If you use the function code itself, do not include the function wrapper by removing the function line and last curly bracket "}".

Note the last line of the function defines what happens in the document window. In this case it requires the LastViewViewed variable set in the View templates that are used.

I use the following code in the templates JS Header section to do this:

 adate = new Date(); window.parent.LastViewViewed=window.location.href + "&rnd=" + adate.valueOf();

The code appends a unique value to the current URL so that the server is hit again instead of relying on the cache. This helps to make sure the view is refreshed after the document is deleted.

Dig Deeper on Domino Resources - Part 3

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...