Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Can a drop down list have multiple columns?

Avatar

Former Community Member
I'm trying to set up a drop down list with 2 columns, I would like the first column to be the value to populate the form with and I would like the second column to be a description of the first column. I don't want the value of the second column to appear on the form. Is this possible? Is it possible to import a table to populate the drop down list?
4 Replies

Avatar

Former Community Member
well, yes.<br /><br />Use "Specify Item Values" in the bindings tab in the object window. If you want to add items by JS use something like this:<br /><br />var countries = new Array("Belgium", "France", "Norway");<br />var countrycodes = new Array("BE", "F", "NO");<br /><br />//Please note that both variables MUST be strings, not numbers etc. <br />//If you want to use numbers/dates, convert them to strings before<br />//the addItem method. E.g. var myVar = String(19);<br /><br />for(i=0;i<countries.length;i++){<br />DropDownList.additem(countries[i], countrycodes[i]);<br />}<br /><br />best regards,<br />Håkon

Avatar

Former Community Member
Thanks Hakon. It's not quite what I'm looking for though. I'm looking for a drop down list that displays the value "Country" and also displays the description of the value "Country description" for the end user to see. However I just want the value "Country" to placed on the form. Using your example the user would see "Belgium Kingdom of Belgium" , with Belgium being the only value that I want displayed on form. Any suggestions?

Avatar

Former Community Member
No, I don't believe it's possible. I tried to remove the arribute presence="hidden" on the column, but it had no effect. So.... I believe that you would have to combine the two pieces of test before entering them into the itemlist.



Håkon

Avatar

Former Community Member
How about this. I made a drop down list with the following items,



BE, Belgium

F, France

NO, Norway



I added two spaces between the comma and country name. Then I clicked on the Binding tab and checked the Specify Item Values check box and entered the letter designation for the country as the value for each of the items in the drop down list,



BE

F

NO



Then I added a text field and added a JavaScript for the calculate event thus,



TextField1.rawValue = DropDownList1.rawValue;



When I select an item in the drop down list in PDF Preview such as "F, France" then the "F" is placed in the text field.



Is this what you are looking for to do?