logo

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.

Image

How to do this:

There are two approaches. Which we use depends on whether the view in question is being treated as HTML as in the picture below:

Image



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:

"[<a href=\"" + @Text(@DocumentUniqueID) + "?EditDocument\"><img src=\"/icons/vwicn012.gif\" width=\"13\" height=\"11\" alt=\"Edit!\""></a>]"


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...


Feedback

  1. 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.

    1. Re: errors and authorization

      thanks a lot! This is useful for me.

    • avatar
    • Daria
    • Thu 1 Jun 2006

    Edit links and security

    Great tip!

    But what about if the user does not have access to Edit the document?

      • avatar
      • Jake Howlett
      • Thu 1 Jun 2006

      Re: Edit links and security

      They get a login screen/dialog

      Show the rest of this thread

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:



Navigate other articles in the category "Views"

« Previous Article Next Article »
Auto-Launch a file attachment   Control the look of Domino view tables

About This Article

Author: Jake Howlett
Category: Views
Keywords: edit; document;

Attachments

imginc0xx.gif (4 Kbytes)

Options

Feedback
Print Friendly

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »