Rich-text and dialogbox problem in LS

Hi,

Why when you modify a text-rich field in a Dialogbox you can retreive the modification in a document ?

I’m explain, suppose you have a form name “doc” with three editables fields :

Username, type name

Subject, type text

Body, type rich-text.

You have an action button with the following code :

Sub Click(Source As Buton)

Dim ws as New NotesUIWorkspace

Dim db as NotesDatabase

Dim doc As NotesDocument

Dim rtbody As NotesRichTextItem

Set db = ws.CurrentDatabase.Database

Set doc = db.CreateDocument()

doc.Form = “doc”

doc.Username = db.Parent.UserName

doc.Subject = “Subject for example”

Set rtbody = doc.CreateRichTextItem(“Body”)

Call rtbody.AppendText(“Please explain your reason…”)

Call rtbody.AddNewline(1)

Call rtbody.AppendText(“here !”)

Call rtbody.Update()

if( ws.DialogBox(“doc”, True, True,True,True,False,False,“New doc”, doc) ) Then

Call rtbody.Update()

Call doc.Send(False)

End If

If the user modify the username field or subject field the data is updated in my Notesdocument doc send but not the rich-text field Body.

How i can do ?

I don’t want to save the doc because this is a notification send in the user’s mailbox.

Any idea ?

Subject: Rich-text and dialogbox problem in LS

I forgot to add one thing, Try using your own OK and Cancel buttons, that way you can refresh the backend document without extra code inside the if statement…

Hope this helps…

Best Reards,

Munish Kaushik

Subject: Rich-text and dialogbox problem in LS

Hello Stephane,Since You are opening a document in UI and then use backend of the same in send method. In this case Rich text doesn’t get updated.

You will have to update backend document with what is there in frontend and for richtext that can only happen if you close and reopen the same document.

Open the document in UI.

Try using Refresh method of NotesUIdocument with true as flag. e.g. Call notesUIDocument.Refresh(true)

Close the UIdocument.

then send the document.

e.g.

if( ws.DialogBox(“doc”, True, True,True,True,False,False,“New doc”, doc) ) Then

Set UIdoc = ws.editDocument(true,doc)

Call UIDoc.Refresh(true)

Call UIDoc.Close()

Call rtbody.Update()

Call doc.Send(False)

End If

Something to aboe tune should work for you. Try and let us know the results.

Best Regards,

Munish Kaushik

Subject: Rich-text and dialogbox problem in LS

Straight from the Notes Designer Help Database - topic: Dialogbox Method…

“Field sharing is not supported for rich text fields.”

Alex

Subject: RE: Rich-text and dialogbox problem in LS

well, it’s not fully true. The Help is generally reliable except for cases when it is not, like in this one. In some situations you could get back the RT. So people keep trying.

Subject: RE: Rich-text and dialogbox problem in LS

Hey Normunds…so you’re saying it’s a secret and we have to figure it out? Is there a prize? :wink:

Alex

Subject: RE: Rich-text and dialogbox problem in LS

no it’s not a secret. people have discussed it here. I have posted a code that has worked for me. maybe it does not work for all versions, all platforms, maybe you get problems with something particular, say attachments; dunno it was R5 then (so yes it’s probably discussed in the 4-5 forum). But I think you must be able to get it with some effort.