Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

How to put a line break in between strings?

Avatar

Former Community Member

I'm trying to put a couple of line breaks in between strMessage2 and strMessage3 in the automatic e-mail button in the following document.  What am I missing?  Thanks!

https://acrobat.com/#d=hSatmYfM4gqdX1cb-XRVMg

Win 7, LC ES2 9.0

1 Accepted Solution

Avatar

Correct answer by
Level 10

Make sure you are using \n and not /n.

View solution in original post

10 Replies

Avatar

Level 10

"\n" is a return in JS.

So if you add a couple at the beginning of your strMessage3 text it should do the trick: "\n\n**THE DCO REQUEST..."

Avatar

Former Community Member

Nope, that doesn't work.  It only prints the "/n/n" as text before the message.  Putting it outside just before the quotes does not work either, that disables the button function completely.

Avatar

Correct answer by
Level 10

Make sure you are using \n and not /n.

Avatar

Level 5

I'm using these "\n" in several scripts that have multiple lines, so I'm using the "+" at the end of the line to continue.  When I use a single "\n" the "+" becomes inactive, but when I use "\n\n" it works again.  Do you know what this is about?

This works:

"bla bla \n\n" +

This doesn't work:

"bla bla \n" +

Avatar

Level 5

Can anyone shed any light on this?  Thanks.

Avatar

Level 7

both work fine for me.

I had to add "bla bla \n\n" + "bla" or "bla bla \n" + "bla" If you have the + after but do not follow it with something then it does not work.

Avatar

Level 5

When I put just one ".... \n" at the end of a line, the "+" goes inactive (not blue), like it's not working.  What am I doing wrong?

Avatar

Level 7

You are correct the + sign does turn black after a single return \n but blue after a double \n\n but both work for me. It could be a bug in LCD. To be honest I did not even notice the color change until I changed the font size of my script window.

Avatar

Level 5

You were right!  I assumed because the color was not correct that the syntax was bad, so I never actually tried leaving it that way.  As you say, it does work.

Thanks.