Hi
Here is a function which will filter a connection dropdown using the selection from another dropdown. Change the ‘view_xxx’ to match the view you have the two dropdowns in. Put the integers of the field_xxx for the dropdown you want to select in ‘yyyy’ and the integers of the connection field_xxx you want to filter in ‘zzzz’.
$(document).on('knack-view-render.view_xxx', function (event, view) {
filterConxFromDropdown(view, yyyy, zzzz)
});
function filterConxFromDropdown(view, dropdownFieldID, conectionsFieldID) {
//Add a change function to your select dropdown
$('#' + view.key + '-field_' + dropdownFieldID).change(function() {
//get selected value from dropdown
var selectedValue = $(this).val();
// hide and show list items that do not contain selectedValue
$('#' + view.key + '_field_' + conectionsFieldID + '_chzn li').each(function() {
//get the text of the list item
var text = $(this).text();
//if the text does not contain the selectedValue
if (text.indexOf(selectedValue) == -1) {
//hide the list item
$(this).hide();
} else {
//show the list item
$(this).show();
}
});
});
}
I hope you find this useful and I’ll be happy to help if you need it.
Craig
p.s. This is the first time I have put code here so if you have any suggestions for make this clearer I would be happy to change anything.
Update - Ihave changed the function as I have made an Error the code now works