This solution lets you convert multiple single line textfields to cascading dropdowns populated by a query into another list that holds the data.
I’m reusing these two images from a previous article in this series to demonstrate the source list configuration and the target list appearance after the solution is initiated:
I have previously posted two solutions in this series:
Cascading dropdowns in SharePoint text fields – populated by lookup in another list (version 2)
This is the third revision done mainly for compatibility with the Dynamic Forms for SharePoint solution, but it can also be used as a standalone solution. The earlier solutions had a 5-level limit, but this one in unlimited.
Refer this solution in the CEWP where you set up the DFFS solution like this:
To use this as a standalone solution, you must do the configuration in the CEWP code like this:
lookupList: List name or GUID of the list that holds the values to populate the dropdowns.
lookupListBaseUrl: Base URL of the site where the list is located. This is NOT the URL of the list itself.
lookupListFields: The FieldInternalNames of the fields in the above list.
thisListFields: The FieldInternalNames of the fields to convert to dropdowns.
dropDownDefaultvalue: The value to display in the dropdown select when no items has been selected.
hideEmptyDropdowns: Determines whether or not to hide dropdowns with no available options.
autoselectSingleOption: If the next dropdown contains only one option it will be automatically selected.
clearInvalidSelection: If you open a list item in EditForm and the original selection no longer is a valid selection, you can decide whether to clear it or keep it.
debug: Used to troubleshoot the setup. You must have the developer console activated to read the debug information. While this is “true”, the single line of text field will show below the dropdown select.
The length of the arrays “lookupListFields” and “thisListFields” must be the same.
Get the code for the file “CascadingDropdowns.js” here.
Please support the development of this solution by hitting the “beer button” in the top right corner of this page to buy me a few beers.