Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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;
Copy link to clipboard
Copied
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");