Casting RichTextItem

This line is used in a label computed value in an xpage. I would like to cast the returned value to a RichTextItem, however the javascript entry screen for the computed value specifies the error in front of the line under the red cross:

Encountered “doc” at line 3, column 28. Was expecting one of: “in”…, “==”…, etc.

The line of code it deals about is:

var rtitem = (RichTextItem)doc.getFirstItem(“TicketRemarks”);

For the good sake of order, the selected language for the computed value is JavaScript(Server Side).

Could anyone help me what is wrong about the casting.

Thanks in advance.

Subject: Same problem here - my solution…

I was trying to get HTML markup stored in a Rich Text field but had the same problem. I can’t find a way to return the correct data type either. The code in help not only produces an error in the Designer editor but fails on the server as well.

I wound up adding a field on the form called ‘HTML’. This special field name works for this purpose. You might consider doing the same and have it be calculated on the form from your source Rich Text field.

Ken

Subject: Why are you using a cast?

Can you say what you want the cast to accomplish? Perhaps there’s a different way to make that happen.

Subject: Purpose of Cast

the purpose of the cast is for getting a rich text object and from here I create the unformatted text version of the rich text item. Actually I want to strip all tags which are influencing the display style.

I also tried the example code in the help file for getFirstItem and is listed below.

Document doc; //…set value of doc…

RichTextItem rtitem = (RichTextItem)doc.getFirstItem(“Body”);

Thanks for your help already.

Subject: Purpose of Cast

Subject: take a look at this

(Too much to retype!)

If that does not help, please post the problems you find!