Jump to content

Dynamic changing dropdown boxes


alanl1

Recommended Posts

Hi All.

I have a javascript function that changes the value of the next dropdown box from a list of multiple dropdown boxes based on an onchange event as shown below. 

 

What I want to do is if the user selects for instance "software manufacturer" then it is never available again in any of the next dropdown boxes.

 

I can get this to work for the next checkbox but it comes back again for the 3rd checkbox.

 

Hope it makes sense

 

 

 onchange="fillSelect(this,categories[this.value]

 

var categories = [];
categories["startList"] = ["Software Manufacturer","Product Name","Product Version","Keep Existing","Ignore"]
categories["Software Manufacturer"] = ["Product Name","Product Version","Keep Existing","Ignore"];
categories["Product Name"] = ["Software Manufacturer","Product Version","Keep Existing","Ignore"];
categories["Product Version"] = ["Software Manufacturer","Product Name","Keep Existing","Ignore"];
 categories["Keep Existing"] = ["Software Manufacturer","Product Name","Product Version","Keep Existing","Ignore"];
 categories["Ignore"] = ["Software Manufacturer","Product Name","Product Version","Keep Existing","Ignore"];
Link to comment
https://forums.phpfreaks.com/topic/279296-dynamic-changing-dropdown-boxes/
Share on other sites

If I understand correctly you are populating the select boxes with the categories array?

 

If so then in the onchange you would check to see if the selected value is in the next object array.

 

So if they chose Product Name in the startList select box you would remove Product name from the Software manufacturer object array.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.