Adding or appending plain text to a rich text field

Thanks for reading this post.

I’m having a problem trying to do something so simple and its killing me.

I have a web application, that takes plain text from a field – passes it to an agent using AJAX, which then

  • locates a document in the db using its UNID

  • gets the rich-text field called “supportComments”

  • appends the plain text to that rich text field.

Im using RichText for the storage length capabilities as am worried that plain text would max out.

But i cant for the life of me get it happpen.

Could anyone help? Ive posted some same code below:

Heres the string passed to an agent via AJAX:

“action=sendEmailReply&docid=403B8E717E9827DCCA25721400735083&userid=0001&content=

The rain in spain falls mainly on the plane

”

The corresponding agent (ive removed somecode) , that actions this request is:

Function sendEmailReply(db) As String

'get the backend doc

Set hddoc = getDoc(db, “byunid”, agentReq(“docid”))

'Add string to case sumary

Dim  rtitem As Variant

Set rtitem = hddoc.GetFirstItem("caseHistory")



Call rtitem.AppendText( "Add text to the rich text item" )

Call rtitem.AddNewLine( 1 )

Call rtitem.AppendText("Add more text to rich text item")

Call hddoc.Save( False, True )



Print |{|

Print | "returnCode" : "Ok", |

Print | "message" : "The reply has been sent and also added to the case history"|		

Print |}|

Please if you have even the slightest idea, im going nuts!