Skip to main content
Participant
April 8, 2024
Question

Export Values to appear as a list.

  • April 8, 2024
  • 2 replies
  • 554 views

I have a text box which populates automatially from a dropdown list. However - I need the text in the export value to appear in the text box as a list. How do I add line breaks between items in the export value? 

 

E.g. The dropdown option is "Passing" and the export value says 1) Face target, 2) Raise leg, 3) Kick ball, 4) Follow through.

 

How do I get that text to appear in the text box as:

 

1) Face Target

2) Raise leg

3) Kick ball

4) Follow through

 

Thanks! 

This topic has been closed for replies.

2 replies

Thom Parker
Community Expert
Community Expert
April 8, 2024

First, the text box needs to be setup as multiline.  

Next, there are a couple of ways to insert line feeds into text. 

Sinces it looks like the numbered options are separated with a comma, the esiest thing to do is replace the commas with a line feed.   I don't know how you are currently coding this, so here's just the code for doing the replacement. The "replace" function is the only important part. 

 

var strMultilineValue = strExportValue.replace(/\,/g,"\n");

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Nesa Nurani
Community Expert
Community Expert
April 8, 2024

First you need to set text field to multiline in field properties, and let's say text field is named "Text1" try something like this as custom calculation script of dropdown field:

var str = event.value;
var items = str.split(", ");
var cList = items.join("\n");
this.getField("Text1").value = cList;