Copy link to clipboard
Copied
I want to Select Black And its show Black in Dropdown menu, when i click dropdown menu its show red only---
Step 1:- I Select Black in Drop Down Menu
Step 2:- Alert:- You have selected Black
My If condition is not satisfied, How to put right condition of if
var dlgMain = new Window("dialog","CCCCCCC", undefined, { closeButton:true} )
dlgMain.marginLeft = 15;
dlgMain.center();
dlgMain.orientation = "row";
var dropdown7_array = ["Black","Red","White","Blue","Green"];
var dropdown7 = dlgMain.add("dropdownlist", undefined, undefined, {name: "dropdown7", items: dropdown7_array});
dropdown7.selection = 0;
dlgMain.show();
if(dropdown7.selection==dropdown7.items);
{
alert("red");
}
I extended my code of .text, so now you can use conditions to check chosen color name.
Copy link to clipboard
Copied
// DIALOG
// ======
var dialog = new Window("dialog");
dialog.text = "Color Nippon";
dialog.orientation = "column";
dialog.alignChildren = ["center","top"];
dialog.spacing = 10;
dialog.margins = 16;
// PANEL1
// ======
var panel1 = dialog.add("panel", undefined, undefined, {name: "panel1"});
panel1.text = "Color Change";
panel1.orientation = "column";
panel1.alignChildren = ["left","top"];
panel1.spacing = 10;
panel1.margins = 10;
var statictext1 = panel1.add("statictext", undefined, undefined, {name: "statictext1"});
statictext1.text = "Please choose color";
var dropdown1_array = ["Choose","BS 9102","OW001","OW002","OW003","OW004","OW005","OW006","OW007","OW008"];
var dropdown1 = panel1.add("dropdownlist", undefined, undefined, {name: "dropdown1", items: dropdown1_array});
dropdown1.selection = 0;
dropdown1.preferredSize.width = 100;
dropdown1.alignment = ["center","top"];
var button1 = panel1.add("button", undefined, undefined, {name: "button1"});
button1.text = "Ok";
button1.alignment = ["center","top"];
button1.onClick = function(){
dialog.close()
$.evalFile(File($.fileName).parent.fsName + "/folder_color/"+ dropdown1.selection+".jsx");
alert(dropdown1.selection);
}
dialog.show();
please help me to fix the above code error, can't get the dropdown1.selection value, I put the dropdown1.selection value in “+ dropdown1.selection +” there is an error
Copy link to clipboard
Copied
dropdown1.selection.text
Copy link to clipboard
Copied
Thank you for supporting me
Copy link to clipboard
Copied
typeof dropdown1.selection == 'object'
use dropdown1.selection.toString() or dropdown1.selection.text
Copy link to clipboard
Copied
Or:
unescape(dropdown1.selection)
You can also check few things by:
uneval(dropdown1.selection)
Copy link to clipboard
Copied
Thank you
Copy link to clipboard
Copied
Your thread has been merged with other referring to same question. If you're 1st time posting, don't forget next time to use Correct Answer button, so other users may find help much faster.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now