Quick edit document link
When in a view in the Notes client it is easy to open a document in edit mode. You can either press Ctrl + E or right click the document and choose Edit. In the browser these are not options. Your standard link simply opens the document in read mode.
When you know you want to edit a document straight away, having to open the document and then find the edit link can be annoying and slow if you only have a dial-up connection.
Simple idea: Why not have two links in your view. One to open the document and one to edit it. The only difference being whether the link ends in "?EditDocument" or "?OpenDocument".
Consider the picture below. This is a screenshot of CodeStore's "Draft" view. This is where I put ideas before I get around to turning them in to articles. More often than not I know I want to go straight in to edit mode from this view. That is what the little pencil icon is for. If I want to read the document I use the normal blue link, whereas, if I want to edit the document, I simply click the pencil's image.
There are two approaches. Which we use depends on whether the view in question is being treated as HTML as in the picture below:
If you are using HTML then in the column that you want the edit link to appear add the following:
"<a href=\"" + @Text(@DocumentUniqueID) + "?EditDocument\"><img src=\"/icons/vwicn012.gif\" width=\"13\" height=\"11\" alt=\"Edit!\""></a>"
If you aren't using HTML then add a new column and in the formula add:
"[
Notice in the above link that I have done away with the full relative URL ("/dir/dbname.nsf/"). If we wanted to do this in a view we would have to compute it and this would lead to index/performance issues. You could store the path in a field in the document but then if the DB moves all these fields will be out of date. Instead, the above link assumes we are at the same level of the DB's structure as the view and so we can start from there, simply by using the DocID of that particular document.
Conclusion
You could of course do away with this and simply use the form property "Automatically enable Edit Mode". This way all documents would be in edit mode when you opened them, no matter where from.
However, I always prefer to give the user as many options as possible. Let them decide how they want to open the document...
errors and authorization
It seems unless, you want an ugly blue border around the graphic the syntax in a view, is:
@NewLine+"<a href=\"rsrc/" + @Text(@DocumentUniqueID) + "?EditDocument\">"+ @NewLine+"<img src=\"/icons/vwicn012.gif\" width=\"13\" height=\"11\" alt=\"Edit!\" border=\"0\" /></a>"
Also, I think if you are seeing this "admin" or "draft" view without authenticating first, then something maybe wrong with the application design.
But I think this is a great tip which I am using in my web apps...thank you Jake.
G.
Reply
Re: errors and authorization
thanks a lot! This is useful for me.
Reply
Edit links and security
Great tip!
But what about if the user does not have access to Edit the document?
Reply
Re: Edit links and security
They get a login screen/dialog
Reply
Show the rest of this thread