Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how to get value from drop down list?

New Here ,
Nov 13, 2010 Nov 13, 2010

here in this script:

var mydlg = app.dialogs.add({name:"employees"});
with(mydlg.dialogColumns.add()){
with(dialogRows.add()){
  staticTexts.add({staticLabel:"employees list"});
}
dialogRows.add();
with(dialogRows.add()){
  staticTexts.add({staticLabel:"select one"});
  var empName = dropdowns.add({stringList:["joe","Sarah","Anne","Andy"], selectedIndex:0});
 
  }
mydlg.show()
}

var Name = empName.selectedIndex;
alert (Name)

when select any element in the list such as the 3th element will get "2",

but i want to get: "Anne"

can any one help me please, thanks.

TOPICS
Scripting
985
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Nov 13, 2010 Nov 13, 2010

Hey!

Just change this line:

var Name = empName.selectedIndex;

to this:

var Name = empName.stringList[empName.selectedIndex];

Hope that helps.

--

Marijan (tomaxxi)

http://indisnip.wordpress.com/

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 13, 2010 Nov 13, 2010

Or try this code:

var empName = ["joe","Sarah","Anne","Andy"]; var mydlg = app.dialogs.add({name:"employees"}); with(mydlg.dialogColumns.add()){ with(dialogRows.add()){   staticTexts.add({staticLabel:"employees list"}); } dialogRows.add(); with(dialogRows.add()){   staticTexts.add({staticLabel:"select one"});   var S_empName = dropdowns.add({stringList:empName, selectedIndex:0});     } mydlg.show() } alert (empName[S_empName.selectedIndex])

Shonky

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Nov 13, 2010 Nov 13, 2010

You messed it up little bit, didn't you?

var empName = ["joe","Sarah","Anne","Andy"];
var mydlg = app.dialogs.add({name:"employees"});
with(mydlg.dialogColumns.add()){
with(dialogRows.add()){
  staticTexts.add({staticLabel:"employees list"});
}
dialogRows.add();
with(dialogRows.add()){
  staticTexts.add({staticLabel:"select one"});
  var S_empName = dropdowns.add({stringList:empName, selectedIndex:0});

  }
mydlg.show()
}
alert (empName[S_empName.selectedIndex])

--

tomaxxi

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 13, 2010 Nov 13, 2010

Yea tommaxi, u r right.

How quotes removed from my code.

I have tested and paste code from ExtendScript Toolkit. How it happed?

Anyway thanks tommaxi

Shonky

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 22, 2010 Nov 22, 2010
LATEST

great

Shonky, Tomaxxi

thanks so much

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines