Home › Forums › Cascading dropdowns › use value from lookup list as value for cascading dropdown
- This topic has 6 replies, 2 voices, and was last updated 1 year, 8 months ago by Alexander Bautz.
-
AuthorPosts
-
-
March 22, 2023 at 20:07 #36559
I have a cascading dropdown that uses a value (case pack) to determine values in the dropdown. That value is actually stored in the item list, where the item (Product) is selected in a dropdown above. How can I get that value to use as the parent column in the form with the cascade?
List 1 – products fields include name and casepack
List 2 – casepack – value
List 3 – order item – includes lookup to product, and a field with partial case pack values, I want to use the casepack from list 1 to filter the dropdown in list 3 based on matches in list 2. -
March 22, 2023 at 23:17 #36563
Can you add some screenshots or mockup of the lists involved so I can better understand what you are doing?
Please specify whether you are using the Classic DFFS or the Modern DFFS.
Alexander
-
March 23, 2023 at 21:46 #36573
This illustrates it, under product I’m using your script to get values from lookup, in there we see the casepack is 12, but how can I get the filed CasePack to populate in this item so it will force the cascaded of less than full case? If I enter a number in the item casepack, the cascade works but I can’t get the value from the product into the orderitem.
Case pack does not have to be in the orderitem, it’s just convenient to use then to filter the less than full case dropdown. That works off of another list that has 2 columns,
Case Pack LessthanCasePack
6, 12 3
12, 18 6
12,18 9based on case pack = 12 my values are 3,6,9 which is correct and it works. the issue is that the 12 comes from the Product which is a lookup.
Attachments:
-
March 24, 2023 at 16:20 #36583
Oh sorry – this is classic DFFS
-
March 24, 2023 at 17:12 #36584
Thanks for the clarification – in case anyone wonders, this is the solution used to pull extra field values from a lookup field: https://spjsblog.com/2013/10/16/display-information-from-another-list-based-on-a-lookup-column-connection-updated-version/
Add this code to your custom js:
jQuery("#dffs_LookupColumnFIN select").on("change", function(){ setTimeout(function(){ var value = jQuery("#LookupColumnFIN_ExtraLookupFieldFIN").text(); setFieldValue("SetFieldFIN", value); },1000); });
Replace LookupColumnFIN with the lookup field internal name, ExtraLookupFieldFIN with the extra field that you want to pull the value from and SetFieldFIN with the internal name of the field you want to write the value to.
There is a 1 second delay to allow for the data to be retrieved before grabbing the value.
Alexander
-
March 28, 2023 at 17:16 #36610
I added this code to the end of my custom JS and not getting anything to populate, could it be that CasePack is a number in both lookup list and parent list?
jQuery(“#dffs_Product select”).on(“change”, function(){
setTimeout(function(){
var value = jQuery(“#Product_CasePack”).text();
setFieldValue(“CasePack”, value);
},1000);
});where Product is the lookup column in the parent list and CasePack is a number field in both lists that I want copied over. also the parent list is a choice field so maybe change to a simple number field?
-
March 29, 2023 at 15:30 #36616
Try adding a debugger statement to the code to have the developer tools pause so you can see what is going on:
jQuery("#dffs_Product select").on(“change”, function(){ setTimeout(function(){ var value = jQuery("#Product_CasePack").text(); debugger; setFieldValue("CasePack", value); },1000); });
Do you get the value you expect?
Read more here about using the devtools: https://developer.chrome.com/docs/devtools/overview/
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.