Cascading Drop Downs

I am trying to implement code in an OnChange script that when one drop down is changed it changes the available values in another drop down. For instance one field is Finish Types: 2603, 2604 are options, when 2603 is select the Finish Options will have A, B, C, as selectable options, and 2604 would give you D, E, and F. Both fields are drop downs, but change the one changes the available values in the other. I couldn't find any example detailed enough for me to get started on this. Would appreciate any code examples that could be supplied. 

  • My solution requires the values of the selection lists to be in a specific format.
    If the parent selection lists has the options

    The "Child" selection list's options must start with the relevant parent option plus a hyphen e.g.


    Selecting "1" in the parent dropdown will filter the child dropdown so only options starting with "1-" are available.

    Put the following in your custom/js folder:

    And in the customcontent of a screen, it can be used like

      filterSelect("comp_c_myparent", "comp_c_mychild");

  • Here is the one I use, this goes into the Custom Content of the page 

    And works on the Code in the first field being something like A, B, C and the second field A1, A2, B1, C1. The coding matches the letters 

    <script language="javascript">
    //add as many as you want here


    function FilterSelection(main, linked)
    var list = $(linked).html();
    $(main).change(function(e) {
    var selected = $(main).val();
    if (selected == "--None--") return;
    $(linked).append("<option value='' selected=true>--None--</option>");



  • I think (as my dev gave me the script) you just need to call it, so provide it a name (so change function() to be function(NewName)) and then you can call on this from the CreateScript of the main fields 

  • How do you deal with situations where I have a dropdown list where some of the options appear for more than one option in the parent list? For example:

    Parent list:

    If I choose A, I need options 1, 2, and 3 shown in the child list. If I choose B, I need options 2, 3, and 4 to appear. In this example choosing either A or B, both will have the common elements 2 and 3 shown in the child plus their additional unique ones.

  • My original script would require you to make multiple sub-values 

    Another way to do this is to approach this differently. Ignoring my script you could do it this way. Lets say we have two Selection fields 

    Selection-A (e.g. A,B,C,D)

    Selection-B (e.g. 1,2,3,4,5,6,7,8,8,9,10)

    And we want A to control B. But you want values in B to be available to multiple values. in A. 

    Create a 'Master' B list in the normal fashion 

    Then within Translations you manually create an entire new list of items (e,g, capt_family='Selection-B1') which only has (1,2,3,4) and then do it again for capt_family='Selection-B2. Which has (1,3,5,7) 

    Then on your screen within CRM you could put an OnChange script in on the Selection-A field that If Selection-A = A then change the capt_family of Selection-B to be Selection-B1 but if you change it to B then change it to Selection-B2

    So long when you build the values you use the same codes in B1 and B2 just choosing to not include them all. 

  • Now that is thinking out side the box Mr. Shaw, I utilized something similar to what you said however I just hard coded each value in my code. Thanks again in time switching to your recommendation pertaining to Capt_family may very well happen.

  • I've implemented it once at a customer site with just two selection fields, but built 4 custom capt_familys for the sub level, but works a treat. It is a headache for maintenance but so long you're not needing to add values all the time it should be OK. 

Reply Children
No Data