Expand my Community achievements bar.

Newbie question - importing long lists of dropdown values

Avatar

Level 1

My apologies, it seems like this must have been answered a jillion times here but I can't seem to find it.  Here's my problem - I'm creating static dropdown list fields, so I'm not using a dynamic datasource (can't for this, they may not be online when they're filling out the form) and I have long lists of values that I have to give the user to select from.  What I'd like to do is something like enter all the values in a column of a spreadsheet and export it as csv? xml? and then import it into LiveCycle (8.2.1).  Please tell me there's a dead simple way of doing this?  Thanks!

Robert

2 Replies

Avatar

Level 6

Hi,

You can put some string with values that you need splitted by some char:

     combova1,comboval2, comboval3

then you can use this script:

dropValues = stringVal.rawValue;

// add each choice to drop down

choices

BR,

= dropValues .split(",");

for (var i = 0; i < numchoices; i=i+2)

{

yourDropDown.addItem(choices[i]

, choices[i+1]);

}

var numchoices = choices.length;

var numchoices = choices.length;

for (var i = 0; i < numchoices; i=i+2)

{

yourDropDown.addItem(choices[i]

, choices[i+1]);

}

Paul Butenko

Avatar

Level 1

Thanks Paul!  I found an even easier way to do this by looking in the XML Source view.  All I need to do is create a dropdown field and populate one value in Design View (just to get the XML structure initialized for me) and them copy and paste my big list of values, formatted like this:

<text>Arabic</text>
<text>Bulgarian</text>
<text>Catalan</text>
<text>Chinese</text>
<text>Chinese trad.</text>
<text>Croatian</text>
...

There are two XML elements there, one for the labels (<items>) and one for the values (<items save="1" presence="hidden">), so they can be different or the same depending on what you need.

thanks,

Robert