Update fields on doc with Javascript

Can someone help with a Javascript issue that I’m having? This is for a web based application which is why I’m using Javascript. From a View, I have the following column definition:

@If(Documentstatus=“Draft”;“[Delete]”;REPORTID)

The column displays the word ‘Delete’ as hyperlink which calls a Notes Agent. This appears to be working. Following is the agent that is called:

Sub Initialize

Set session = New notessession

Set db = session.currentdatabase

p1= Instr(session.documentcontext.query_string(0),“&”)

If p1 <> 0 Then

arg = Mid$(arg,p1+1)

Set doc = db.GetDocumentByUNID(arg)		

Print "<SCRIPT LANGUAGE="JavaScript">"

Print "if (confirm(""You have chosen to delete a draft document. Click OK to continue or Cancel to exit without changes."")){document.forms[0].Form.value=""(DraftHistorical)"";document.forms[0].DocumentStatus.value=""Deleted"";document.forms[0].submit();alert(""Document has been deleted."")}"

Print "</SCRIPT>"

End If

End Sub

I think I’m having trouble getting a handle on the document? Any help would be appreciated.

Subject: Update fields on doc with Javascript

You’re getting documentcontext from a view - you are not getting the document that the person is trying to delete.You need to put some code behind the delete link. If you search the forum (I tried the R4/R5 forum) - there are plenty of examples of how to delete a document from a view on the web.

Leonardo