How to Preserve Line breaks while copying and pasting the text from String field to HTML field?

pjsnow
Kilo Expert

Hi All - I want to preserve the line breaks while copying and pasting the text from String field to HTML field. Below is the screen shot that I am facing trouble with. And I am using a UI Action for copying and pasting. Any help is really appreciated.

client.u_m1 = current.u_m

 

find_real_file.png

 

Thanks

3 REPLIES 3

Matt Taylor - G
Giga Guru

If your string is picking up on the newline characters in the top text box, you could try a string.replace(/\n/g, '<br></br>') to replace the javascript new lines with with HTML line breaks when it moves it to the lower text box.

That works beautifully!

Since this worked, could you please mark it correct so that others might benefit from the answer?