Adding Carriage Return For Client-Side and Server-Side JavaScript

Mindwatering Incorporated

Author: Tripp W Black

Created: 02/12/2011 at 12:03 PM

 

Category:
Notes Developer Tips
XPages

Issue:
Want to split a text string at the standard semi-colon ";" point and replace with a Chr(13) in JavaScript.
For client-side, it's straightforward, but for server-side, it's touch as "<br/>", "\n", "@NewLine()" nor "@Char(13)" all do not work.

Solutions - client-side:
In client-side JavaScript it is: \n for new line, or for Chr(13) it is: \r.
mystring.replace(/\r?\n|\r/g, "<br>");

Solution:
origstr = rowData.getColumnValue("DocTitle");
@ReplaceSubstring(origstr,';', @Char(13));

previous page