Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How can I remove spaces between lines

Avatar

Former Community Member

Hello,

I have a simple text field and when I paste something copied from internet explorer in this field there are too many spaces between lines.

How can I remove those extra spaces ?

Example:

When I paste, I receive:

Line 1

Line 2

Line 3

And I want to receive:

Line1

Line2

Line3

8 Replies

Avatar

Level 10

It might be usually because of the formatting done in the browser.. Alternative way of removing the spaces is, paste the text in a notepad and copy from the notepad to your Text field.

Thanks

Srini

Avatar

Former Community Member

Yes, it is from the formatting done in the browser, but I not want to paste in notepad an then in livecycle.

I want to remove the formatting, just like notepad is doing.

Avatar

Level 10

Hi,

you can use a script in the exit:Event of the field to remove all carriage returns.

this.rawValue = this.rawValue.replace(/\u000d/g, "")

Avatar

Former Community Member

This is almost what I want, but this script removes all spaces. I want to keep lines separately.

Script makes:

Line1Line2Line3

And I need

Line1

Line2

Line3

Avatar

Former Community Member

Should I understand that it is not possible ?

Avatar

Former Community Member

I really need to post another file on my termopane preturi website. I am already using this file made with live cycle, with great succes.

So, again, can somebosy please answer my question. Thanks.

Avatar

Level 10

Take a look at the following link and see if it helps - the author describes the problem of dealing with line feeds and carriage returns in JavaScript.

http://www.bennadel.com/blog/161-Ask-Ben-Javascript-Replace-And-Multiple-Lines-Line-Breaks.htm

I just did a google search on "javascript remove line feeds".