Link to home
Start Free TrialLog in
Avatar of lovemeto
lovemeto

asked on

deleting document in a view

hi experts,

i have a view that contain all of documents, i  have a move to trash button that deleted selected document and the document will move to trash view it works fine.

the problem is how can i avoid user by simply clicking  the delete key on the keyboard or by clicking the right button of the mouse and selecting delete or cut option I want them to delete the seleted document by clicking the move to trash buton and if they click the delete key on the key board or using the right click button of the mouse message will promt Telling "Pls use the MOve to trash butoon to delete"  

thank in advance,
love

ASKER CERTIFIED SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of p_partha
p_partha

On the button, just set the value of a field to :

buttonclicked:="true"


and as bozzie said use querydocumentdelete and write this code:

if buttonclicked <> "true" then
msgbox "Pls come via the trash button"

continue  =false
end if
As always there are ten different methods to do something in Notes. I think that just disabling the Delete-key for document deletion is a poor man's solution. The user already knows all about deleting documents in his mail-file. This standard method to remove documents is suddenly disabled, in favour of some "clumsy" button on the screen. Second-choice approach.

First choice to me still is to enable soft deletions: supported entirely by Notes, changes Modified-time but probably doesn't add a name to $UpdatedBy. Yes, indeed, it requires more understanding and maybe some different coding, but it's standard and close to normal behaviour.

So, if you need a quicky, go for disabling the key, but if you want a good solution, go for soft deletions.
Here's some code I throw into Database Resources -> Database Script -> QueryDocumentDelete() to prevent deletion.

Sub Querydocumentdelete(Source As Notesuidatabase, Continue As Variant)
     Continue = false      
     Messagebox "Deletion is not allowed",,"Notice!"
End Sub

You can test certain fields or roles or anything else for that matter here if you have requirements
HTH,
Yoshi