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

skip a line?

Eikou
Registered: Feb 5 2009
Posts: 30
Answered

this.getField('Summary').value = this.getField("T1").value + '\n' + this.getField("T2").value + '\n' + this.getField("T3").value + '\n' + this.getField("T4").value;

it gets in the summary field the value of T1, T2, T3, T4 and place it under each other.
it look like this:

1. Cyaan
2. Magenta

4. Black

as you can see when T3 is empty and it doesnt skip the line to make it like:

1. Cyaan
2. Magenta
4. Black

what i want is that it checks the empty part and SKIP/REMOVES that line to place it nicely under each other...

yeah just to make it placed nicely under each other. cause my Texfields goes to T99 : p so i need a smooth summary field what is filled

My Product Information:
Acrobat Pro 9.0, Macintosh
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Try something like:

function addCR(s) { // Add a carriage return if string is not emptyreturn s ? s + "\r" : s;} // Build the stringvar s = addCR(getField("T1").valueAsString);s += addCR(getField("T2").valueAsString);s += addCR(getField("T3").valueAsString);s += addCR(getField("T4").valueAsString); // Set field valuegetField('Summary').value = s;

Though you might want to place the function in a document-level script.

George
Eikou
Registered: Feb 5 2009
Posts: 30
tnx George,

marvelous script!