What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

How to put multiple values into an array of a dropdownlist?


Messages
9
Likes
0
With this part of code, I am trying to put all found layer names (layersData) into dropdownlist2_array, but instead of a list with names, I get one line with all names!!! Any idea what am I doing wrong? Thank you in advance!!!
JavaScript:
var layerNames = [];
for (var i = 0; i < layersData.length; i++)
{
    var layerName;
    layerName = layersData[i].name;
    layerNames.push(layerName);
};

var dropdownlist2_array = [layerNames]; 
var dropdownlist2 = panel2.add("dropdownlist", undefined, dropdownlist2_array); 
dropdownlist2.selection = -1; 
dropdownlist2.text = "Layer Name:";
 
Last edited:
I populate a dropdown in one of my custom script. Take a look at the code below. "arrayProjet" is an array similar to your "dropdownlist2_array"...

for (var a =0;a<arrayProjet.length;a++) {
win.GrpProjet.ddProjet.add('item',arrayProjet[a]);
}


You need to populate the dropdown in a "for" loop.

Hope this helps.
 

Back
Top