Replace “See attached file:” in XPages

April 15, 2011 – 11:50 am

I got a phone call from a customer today asking if it is possible to replace the “See attached file” string in our corporate intranet by the attachment, so he would not need to scroll down to the end of an article to open an attachment.

After an hour of try and error, I ended up with the following code.

Place the code into the “AfterPageLoad” event of your XPage or Custom Control.

Or you can paste the code as a xp:customConverter directly into the RichText Control.

It searches for all occurrencies of “See attached files” in the RichText field that is displayed on the web with an id of “entryBody” and builds a hyperlink for each attachment as a replacement.

The result looks like this

You can now click the link to open the attached files.You can easily enhance the code to display nice looking images instead of the link text.

If there is a more elegant solution around, pls. let me know.

 

  1. One Response to “Replace “See attached file:” in XPages”

  2. Very, very nice. Thank you!

    By Henning Heinz on Apr 15, 2011

Sorry, comments for this entry are closed at this time.