So, long story short, Microsoft's CU turned off the complex lookup functionality that we loved and locked it down so we can't turn it back on. Rolling back the update isn't an option, so I am now tasked with recreating the functionality on the New Item form using jQuery.
The form has two fields that I'm working with - a text box (input) and a drop-down that pulls values from another list (select). To recreate the previous functionality, I need to search the drop-down for the value being typed into the text box. The snippet below (in theory) tries to set the select value to that text.
<script type="text/javascript">
$(document).ready(function(){
var strBidName = $("input[title='Bid Title']");
strBidName.keyUp(function() {
$("select[title='Project Name'] option[text=' + strBidName + ']").prop('selected','selected');
});
});
</script>
I've tried several variations of the last line with no success. I've also tried using a focusOut event instead of keyUp. No success. Each option in the SELECT field has a value (the item ID) and a text label (what you see in the drop-down list). I have to use the text label because I won't know the item ID.
Have any other SP admins had to do this? I know there are 3rd-party products that supply the functionality, but it should be possible using jQuery, right?
Windows 7/10 clients, IE 11, SP2013 enterprise, jQuery 1.11 being used
EXAMPLE:
So if a user is typing "1200 Roadway Avenue" into the BID TITLE field, and there's already a project in the drop-down called "1200 Roadway", I want that option to be selected to show the user that it already exists in the list.
option[text=' + BidNameFixed + ']
is trying to find OPTION tags with a 'text' data-attribute; I would start checking if those exist. Note: this is not a SharePoint problem, basic DOM element operations: stackoverflow.com/questions/29452870/… – Danny '365CSI' Engelman Mar 15 '17 at 17:50