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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.