Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

linked combos

Status
Not open for further replies.

thompom

Technical User
Dec 4, 2006
395
GB
hi, having made my combos get there data from mysql
using asp - i want to link the combos so that when one has an option selected another one is populated
dynamically.

in this app a user selects a site and then another combo is populated that sites departments.

have done this in asp using javascript.
i suppose i have to call the javascript function from my first combo?

have searched but all 'dynamic combo flash' searches come back with methods to populate from databases.

any ideas welcome

thanks MG
 
just a bit more info

my existing combo actionscript is

Code:
var myData:XML = new XML ();
myData.ignoreWhite = true;
myData.load ("sitecombo.asp");
myData.onLoad = function (success:Boolean):Void
{
if (success)
{
var data:XMLNode = this.firstChild;
var children:Array = data.childNodes;
var numItems:Number = children.length;

for (var i:Number = 0; i < numItems; i++)
{
var child:XMLNode = children[i];
var id:String = child.attributes.id;
var site:String = child.attributes.site;
sitecombo.addItem (site, id);
}
}
else
{
trace ("Error loading data");
}
};

my call to the javascript is
Code:
onChange= EW_updatecombo(this.form.x_deptid, ar_x_deptid, this.options[this.selectedIndex].value);

and the javascript function ew_updatecombo
Code:
function EW_updatecombo(obj, object_value_array, filter_value) {
	var value = obj.options[obj.selectedIndex].value;
	for (var i = obj.length-1; i > 0; i--) {
		obj.options[i] = null;
	}	
	for (var j=0; j<object_value_array.length; j=j+4) {
		if (object_value_array[j+3].toUpperCase() == filter_value.toUpperCase()) {
			EW_newopt(obj, object_value_array[j], object_value_array[j+1], object_value_array[j+2]);			
		}	
	}
	EW_selectopt(obj, value);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top