Home › Forums › Cascading dropdowns › Use Cascade with Lookup column as first drop-down
- This topic has 3 replies, 2 voices, and was last updated 5 years, 4 months ago by Alexander Bautz.
-
AuthorPosts
-
-
August 9, 2019 at 03:09 #26561
Hi Alexander,
I have looked everywhere but cannot find an answer.
Is there a method of using a SharePoint lookup column as the first drop-down to then cascade the value to a 2nd text column?
Thanks,Brett
-
August 10, 2019 at 14:04 #26567
Hi,
Unfortunately this is not possible. You can however make it work with some custom js and the use of SPJS-Lookup instead. See this example: https://spjsblog.com/forums/topic/combing-spjs-lookup-with-cascading-dropdowns/#post-9408If you look at this snippet:
// Add change event $("#Task_x0020_Force_spjs_lookup").change(function(){ buildNextDropdown($(this).find("option:selected").text()); });
You can change it like this to make it work with a lookup column and use it as your first “cascading dropdown”:
// Add change event $("#dffs_LookupColumnFIN select").change(function(){ buildNextDropdown($(this).find("option:selected").text()); });
Replace LookupColumnFIN with your lookup column name.
Alexander
-
August 11, 2019 at 07:44 #26571
HI Alexander,
Thanks, this worked with rendering the text field as a drop-down with the list of options.
But the end result is to be like a cascading drop-down which only returns a single value.
I tried the filterObj setting to return a single value but I can’t figure out how to return a value based on the lookup ID column.Does it make a difference if the column values returned is another Lookup column?
I tihnk it’s easier to replace all lookup columns with Single-line text fields and configure cascading drop-downs in DFFS?
Thanks for your help anyway 🙂 -
August 11, 2019 at 15:33 #26573
I’m not 100% sure I understand, but when you use a set of cascading dropdowns the value in each of the fields will be saved and not only the last dropdown – each level must be single line of text field in your form.
Using the method described above you can nest multiple spjs-lookup’s by attaching a change function and have this call the function to build the next level dropdown using the previous dropdown value as filter.
If you need the ID of the lookup dropdown item you can change the function from this:
buildNextDropdown($(this).find("option:selected").text());
to this
buildNextDropdown($(this).find("option:selected").val());
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.