Question

I'm getting document history, adding "\n" and existing document history. Code executes without any error. But when I see it in web everything on one line. In notes client, document history is shown as one line of activity.

Tried with @Newline and same issue.

What I'm doing wrong?

Thanks in advance.

Here is sample code:

var myvar="\n"
var h=getComponent("docHistory1").getValue();
var msg="Stage 2 - LAB Manager approved and completed check. Send to Chemist: " + unm + "  + dt1;
document1.setValue("DocHistory", h + myvar + msg);
document1.save();
Was it helpful?

Solution

Use a Multiline Edit Box xp:inputTextarea instead of a Computed field xp:text and set it to Read only readonly="true".

As an alternative you could still use a Computed field replacing all '\n' with '<br />' and setting escape="false".

OTHER TIPS

Just to give an alternative solution, you could use a style on the computed text component with "white-space:pre" (or pre-line or pre-wrap, see this for the differences) and that would preserve the newlines in the content.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top