Replace “See attached file:” in XPages

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.

 

One thought on “Replace “See attached file:” in XPages

Comments are closed.