Rich Text Summary

They say that people who encounter something disturbing have a defense mechanism which blocks the memory out. That must have been what happened with me this week. There I was yesterday asking what the best web editor was, when, at the back of my mind, I must have known it was all irrelevant. We are stuck with having our rich-text fields the way Lotus dictate to us. There are workarounds, fudges and hacks but the only real way of editing formatted text in the browser is to use the Domino "solutions".

What my mind had blocked out (for my own good no doubt) was the memory of December last year when I went through exactly the same problem. Remember that? It started on the 9th and lasted over a whole week until I settled with this hack. Yesterday was a painful reminder of the lessons learnt. Yet again I am working on a fixed-price project (more fool me!) and already I've spent wasted more than enough time working round Domino's shortcomings.

Hopefully, while avoiding the same rant, I can save some of you the hassle with a short summary of the current state of affairs:

If you need to edit formatted text in both the web and the Notes Client then you're only real option is to stick with the Notes options of either the Java Applet or "Best Fit" ActiveX thingy. This I can understand. After all, they need to make sure both sides are compatible and you can't do anything in the web editor that Notes Rich Text can't handle.

If you are only editing the text on the web then there are a few more options. However, if you want unlimited amounts of content in the field (and why wouldn't you really!?), your best option is still to stick with the Notes options. The other option is to employ a few hacks and limit the users to a certain amount of HTML input. When using these hacks you can employ the editor of your choice. Personally I still think the best is HTMLArea which now supports Mozilla + IE and is highly customisable.

The first hack is to not use a rich-text field at all. That's right! Just use a plain multi-value text field. Use New Line as the separator options and you have yourself a textarea element that you can use as an editor. Drawback to this approach is that you're limited to about 14,000 characters.

The second approach is to use the hack I mentioned earlier. With this approach we are still limited to about 58,000 characters.

So, what is the best option? Well, as ever, it depends. If you can convince your client/users they can live with limited input and only need to edit the content on the web then use one of my hacks. Otherwise you're stuck with the damned Notes offerings.

It's a real shame. I know I constantly berate Domino for its shortcomings, but can you really blame me? I want to amaze my clients, rather than simply satisfy them with workarounds to their requirements. It's not a lot to ask! Is Domino not a content-management system? Why then does it fall so short of the mark in this hugely important area.

The problem with Domino is that it won't let us store HTML in rich-text fields. Ok, it will, but it won't recognise it as HTML. Unless Domino expects the content to be HTML (because we opted to use either applet or best-fit option) it will assume it is plain text. Again Domino tries to take all control from us developers. Does it assume us to stupid to ever be able to do anything other than add fields to forms and tick boxes on the option boxes?! Which brings me back to posting this image:

What we need is either a) Lotus to sit up, listen to reason and sort their act out or b) a way to programatically set the MIME type of the field to text/html instead of text/plain.

As it stands, I've spent enough time on this already, the client seems happy with Java Applets and so that's what he will be getting. At least it might mean some repeat business when things go bad with his application. For that Lotus, I thank you!


  1. Try using the following WebQuerySave agent (richtext field is called mshtmldata):

    Sub Initialize

    On Error Goto herror

    Dim session As New notessession

    Dim db As notesdatabase

    Dim doc As notesdocument

    Dim richStyle As NotesRichTextStyle

    Dim rtitem As Variant

    Dim htmlcode As Variant

    Dim agentLog As NotesLog

    Set agentLog = New NotesLog ("HTML AGENT")

    Call agentLog.OpenAgentLog

    Call agentLog.LogAction ("Starting Agent")

    Set db=session.currentdatabase

    Set doc = session.DocumentContext

    Set richStyle = session.CreateRichTextStyle


    Set rtitem = doc.GetFirstItem( "mshtmldata" )

    If ( rtitem.Type = RICHTEXT ) Then

    htmlcode= rtitem.GetUnFormattedText()

    Call doc.RemoveItem("mshtmldata")

    Set rtitem = doc.CreateRichTextItem( "mshtmldata" )

    Call rtitem.AppendStyle(richStyle)

    Call rtitem.AppendText(htmlcode)

    Call doc.save(True,True)

    End If

    Exit Sub


    Call agentLog.LogError (Err, "Agent Failed:" & Error$ & ", " & Erl)

    Call agentLog.Close()

    End Sub

    • avatar
    • Jake
    • Wed 30 Jun 2004 09:04 AM


    From what I've tested so far, that seems to work fine. What can I say? If there's anything I can do it return David, let me know. You could have saved me days of stress.

    Off to test some more...

    • avatar
    • dc
    • Wed 30 Jun 2004 10:50 AM

    This agent is for an application that is web-based editing only, correct?

  2. Peter Briggs mentioned this approach...

    "...with the richtextfield on my display document enclosed with '[<RTfieldsucks>RTField</RTfieldsucks>]' to display as HTML!...."

    I can confirm that this approach works for me, infact I found out this fix the same way Peter did ;-).

    What Peter did mention is that the field + tags should be marked as pass-thru.

    • avatar
    • Jake
    • Wed 30 Jun 2004 11:07 AM

    Yes dc, it is web-based. Everything on this site tends to be web-based only.

    Stephen. The problem with marking the field as PassThru (although I *have* been using this approach) is that it tends to break once the field gets to a certain size. Hence the 58,000 character limit - best enforced with some JS before submission. I've been testing David Schmidt's approach (see above) and found there to be no limits to the amount of HTML it can deal with. So far, so good.

    • avatar
    • Doug
    • Wed 30 Jun 2004 11:08 AM

    The person who completed the integration of Ektron's eWebEditPro into a Domino environment also used this fix.


    • avatar
    • dc
    • Wed 30 Jun 2004 11:16 AM

    Jake, thanks for the answer as to whether or not these are web-based only. From the LotusScript David provided, I was able to see this was the case. I needed to verify this is so to make sure that I didn't miss anything. After all, it does happen! :-)

    I am coming from a unique perspective (at this point in time), being that I need to have users edit documents from both the Notes client and the web.

  3. OK thanks... I hadn't realised this limit existed, I guess I need to read your articles more carefully !

Your Comments


About This Page

Written by Jake Howlett on Wed 30 Jun 2004

Share This Page

# ( ) '


The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

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 »

More Content