Populate textedit field with selection from dropdown


hello, everyone!

thank lot of give me since long time.

i ever search , find great solutions.

but, time, didn't find nothing.

 

i need populate textedit field based on selection in dropdown list.

is there way this?

 

my fragment:

var myp0a = mygtop.add("panel", undefined, "journal"); myp0a.margins = [10,15,10,10]; var mytemplate = myp0a.add("dropdownlist", ["","",200,25], ["", "journal 01", "journal 02", "journal 03", "journal 04", "journal 05", "journal 06"]); mytemplate.selection = 0;  var mygdoi = myg1.add("group"); mygdoi.add("statictext", undefined, "doi:"); mygdoi.orientation = "row"; var mydoi = mygdoi.add("edittext", undefined, "000"); mydoi.characters = 34; 

 

based on mytemplate's selection, want populate mydoi field.

is possible?

 

thanks in advance , sorry if question asked in topic.

the selection of dropdown listitem object (or null), hence need collect dropdown selection.text in onchange handler of dropdown:

 

mytemplate.onchange = function(){     if (this.selection===null || this.selection.text.length===0){         mydoi.text = "000";         }     else{         mydoi.text = this.selection.text;         };     // , maybe more stuff here     }; 

 

or equivalently, in shorter form:

 

mytemplate.onchange = function(){      mydoi.text = (this.selection && this.selection.text) || "000";     }; 

 

xavier



More discussions in InDesign Scripting


adobe

Comments

Popular posts from this blog

Soustraire une selection

After Effects: could not find dvaeve_dialogs.txt

Illustrator cs6 "Invalid Serial Number"