# Combo box and change handler - in over my head

**URL:** <https://forum.kirupa.com/t/combo-box-and-change-handler-in-over-my-head/97452>\
**Category:** Uncategorized\
**Created:** [December 22, 2003, 4:53pm UTC](https://forum.kirupa.com/t/combo-box-and-change-handler-in-over-my-head/97452 "2003-12-22T16:53:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lunatic](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@lunatic](https://forum.kirupa.com/u/lunatic)\
**Post date:** [December 22, 2003, 4:53pm UTC](https://forum.kirupa.com/t/combo-box-and-change-handler-in-over-my-head/97452/1 "2003-12-22T16:53:58Z")

</div>

Howdy all,

Anyone know how I can set the data in my combo box = the name of a textfile to be loaded into a dynamic textbox?

I am trying a combo box for the first time. I’ve used AS to load it but am now having trouble with the ChangeHandler function. I only have a couple of items in the combo box and I am using them to load dynamic text files. I am using the following code that I adapted from another thread I found. “sort” is the instance name of my combo box. MCtxt is the name of my dynamic text box:

[AS]  
// change handler callback  
function textSort(filename) {  
loadText = new LoadVars();  
loadText.load(filename);  
loadText.onLoad = function(success) {  
if (success) {  
\_root.MCtxt.html = true;  
\_root.MCtxt.htmlText = this.sortMC;  
}  
};  
}  
// data provider  
var filename = sort.getSelectedItem().data;  
var data\_array = new Array();  
// first item  
data\_array[0] = {label:“Sort documents”, data:""};  
// second item  
data\_array[1] = {label:“By Date”, data:“documents/sort\_date.txt”};  
// third item  
data\_array[2] = {label:“By Type”, data:“documents/sort\_type.txt”};  
// set data provider  
sort.setDataProvider(data\_array);  
// set change handler  
sort.setChangeHandler(“textSort”);  
[/AS]

I can’t figure out how to set “filename” = to the data\_array. Can anyone help? 😃
