These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Replace linefeeds

Pekka
Registered: Aug 26 2010
Posts: 4
Answered

Hi,

I have a text node in context and I place the content of that into textfield. In somecases text node holds several lines and I want to display data in single line. I tried formcalc script $ = Replace($, "/u000d", ", "), this removes the linebreak, but does not insert comma and space.

In what way can I acheve my goal?

-Pekka-

Bamboolian
Registered: Jul 27 2010
Posts: 48
Hi,

I don't really understand why how your code currently removes the linebreaks, but you should use ".rawValue" property and linebreaks should be expressed using "\" i/o "/".

try;
$.rawValue = Replace($.rawValue,"\u000a",", ")
Pekka
Registered: Aug 26 2010
Posts: 4
Hi,
Noup, I tried that snippet with the similar result. I think that it has something to do with the node type that provides the text. Node type text provides data in several lines, but in what form the lines are separated?
Bamboolian
Registered: Jul 27 2010
Posts: 48
Hi,

Sorry, you should need to cosider about return and linefeeds.
try code like following which first replace all linefeeds to carriage return, and then replace all carriage returns to seperaters.

TextField1.rawValue = Replace(TextField1.rawValue,"\u000d","\u000a")TextField1.rawValue = Replace(TextField1.rawValue,"\u000a",", ")
Pekka
Registered: Aug 26 2010
Posts: 4
Hello,
I´ll have to test this.

I´ll introduced form to the client where textfield expands according to number of lines, end they said that it is ok. Actually they prefer this solution now :) , this code will have to wait for the next time. I´m sure it will come.

Thanks,
Pekka