Multiple dropdown combination check and filter

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2010-04-02T09:06:22Z Indexed on 2010/04/02 9:13 UTC
Read the original article Hit count: 199

Filed under:
|

Using Javascript / jQuery, I'm trying to build a "combination checker" that will take the values of three (but can be more) dropdown lists and filter the options based on a supplied list of allowed combinations.

For example:

DROPDOWNS
Field 1:
- value_1
- value_2

Field 2:
- value_3

Field 3:
- value_4
- value_5

COMBINATIONS
- value_1, value_3, value_5
- value_1, value_3, value_4
- value_2, value_3, value_5

When a user selects Field 3 - value_4, the unavailable options will be disabled - ie, Field 1 - value_2 (there is no combination that allows value_2 and value_4 to be selected together).

It would be really great if someone could provide some pointers on how this can be achieved or just provide a fresh perspective - I'm going round in circles on this one!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery