Can I create one dropdown with two children?

Forums Cascading dropdowns Can I create one dropdown with two children?

Viewing 2 reply threads
  • Author
    • #32694

      Hi there,

      I’m trying to create a dropdown cascade which works like the following:

      Parent Dropdown
      —Child Dropdown 1
      —Child Dropdown 2

      I want to select an item in the parent dropdown, and based on the value, populate both of the child dropdowns with the same options.

      Is this even possible? And if so, is it also possible to filter the child dropdowns so they both can’t have the same value?


    • #32702
      Alexander Bautz

      You cannot do this with cascading dropdowns, but with spjs-lookup as described in this post:

      Regarding filtering of the dropdowns:
      Is it when saving the form you need these to to not have the same value? – if so, add something like this in your Custom JS:

      function dffs_PreSaveAction(){
          var field1Value1 = getFieldValue("The_first_field");
          var field1Value2 = getFieldValue("The_second_field");
          if(field1Value1 === field1Value2){
                  "title": "Cannot save...",
                  "msg": "You cannot select the save value in both The_first_field and The_second_field - please correct."
              return false; // Stops the save and exits code
          return true; // Saves the item if this line is reached


    • #32703

      Thanks Alex you’re the man, this does exactly what I wanted!

      I did notice if I change the parent dropdown after selecting something in the child dropdown, the children still contain a value that shouldn’t be available based on the parent option. Is there any way to force the child dropdowns to “reset” if the parent is changed?

      • #32707
        Alexander Bautz

        Is there an option in the child dropdown that is from the previous parent choice, or is it NOT showing, but saving the item will save the value already selected from the last change of the child?

        You can try setting the value back to “” like this:

        	var val = $(this).find("option:selected").text();
        	// Delete current instances of child selects
        	// Set the value back to an empty string
        	setFieldValue("SPJSLookupChild1", "");
        	setFieldValue("SPJSLookupChild2", "");


      • #32708

        It was the first one, changing the parent made an option from the previous parent still show in the dropdown.

        But, your fix worked! Everything is working 100% perfectly now 😀

        Thank you so much for the quick response!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.