Hi!
Say I've got a textfile 'data.txt' with these variables:
//appears in the first dropdown
&selection=fruits,cars,bottled water
//appears in the second dropdown, based on selection in first one
&items0=apple,pear,mango,plum
&items1=buick,dodge,ford,oldsmobile
&items2=evian,perrier,spa,bar-le-duc
I thought something like this ought to do the trick:
I think it's the lineCode:srOverzicht = new LoadVars(); srOverzicht.load("data.txt"); srOverzicht.onLoad = function(success) { if (success) { //split selection into an array srArray = this.selection.split(","); //display items in combobox, stick 'items'+$i as data field for ($i=0;$i<srArray.length;$i++) { dropdownOne.addItem(srArray[$i],"items"+$i); } } } //setting change handler dropdownOne.setChangeHandler("DisplaySelected"); function DisplaySelected() { //identify selection from dropdownone $selected = dropdownOne.getSelectedItem().data; stOverzicht = new LoadVars(); stOverzicht.load("data.txt"); stOverzicht.onLoad = function(success) { if (success) { //load dropdowntwo based on selection stArray = this.$selected.split(","); //display items in dropdowntwo for ($i=0;$i<stArray.length;$i++) { dropdownTwo.addItem(stArray[$i]); } } } }that messes things up. Any idea how I can get around this? The only solution I see at this point, is splitting all data up in a different text file each. I'd like it to work another way, if possible.Code:stArray = this.$selected.split(",");





Bookmarks