Editmode and richtext field

Hello

I have a problem that I think a richtext field in my form is causing it. For example, If I open a form, make changes and it the esc key, I’m ask to save the document. If I add something in the richtext field and it the esc key, the form is closed without asking me to save it. Is the richtext field my problem?

Subject: Editmode and richtext field

Do you have any code in the querysave, postsave or any other save events in the document?

That behaviour is indeed really odd… I have never seen a rich text field act that way.

Benoit

Subject: RE: Editmode and richtext field

Hello Benoit,

I think I found the problem, when I add something in the richtext field, an action button that it use to save the form has a condition: if the richtext field is not empty a copy of that field is made to an other one. The script looks like this:

Sub Initialize

Dim w As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim curdoc As NotesDocument

Dim rtitemA As Variant

Dim rtitemB As Variant



Set uidoc = w.CurrentDocument

Set curdoc = uidoc.Document



Call curdoc.ReplaceItemValue("pjtenr","0")



Call uidoc.Save



Set rtitemA = curdoc.GetFirstItem( "pjt_1" )

Set rtitemB = curdoc.GetFirstItem( "pjt" )



Call curdoc.ReplaceItemValue ("pjt_1", "")

Call rtitemA.AppendRTItem( rtitemB )



curdoc.SaveOptions = "0"

Call curdoc.Save(False, True)

REM 'Call w.ViewRefresh

End Sub

(I’m very new to LS, so I have a hard time to understand the backend and UI things)

I realise that curdoc.SaveOptions = “0” could be the problem. But the script works great (to make the copy of the richtext field in an other one).

I think what I need to do is to reload the document and then put curdoc.SaveOptions = “1” so it will save the document without loosing the copy of the richtext field.

My querysave look like this:

Sub Querysave(Source As Notesuidocument, Continue As Variant)

If Source.FieldGetText("savflag") = "1"  Then

	continue = True

Else

	Messagebox "Vous devez utiliser le bouton Enregistrer pour sauvegarder cette demande.",MB_OK,"Erreur"

	continue = False

End If

End Sub

and my postsave: (writing a transaction log)

Sub Postsave(Source As Notesuidocument)

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument



Set db = session.CurrentDatabase

Set doc = New NotesDocument(db)

doc.Form = "MQE_0004"

doc.seqdmd_log = Source.FieldGetText("seqdmd")

doc.stt_log = Source.FieldGetText("stt")

doc.dtecrt_log = Source.FieldGetText("dtecrt")

doc.usrcrt_log = Source.FieldGetText("usrcrt")

doc.act_log = Source.FieldGetText("act")

Call doc.Save(True, False)

End Sub

Thanks for your help!