I developed an application page for SharePoint, and installed it and the page shows up just fine. The user will have the ability to type in some information, just like a form; this includes selecting his or her name and their manager's name (this data is coming from a database and getting populated into a JSON list on Page_Load). The problem is with jQuery's select event for autocomplete, the list of names shows up just fine but when the user uses the mouse to select the name or hits ENTER on the keyboard, nothing happens for that textbox (I have coded that when the user selects the name, another textbox is populated with the manager name as well and this work just fine). I tested this in all major browsers, and it works perfectly except (of course) in Internet Explorer (v 8 and 9). The JSON being generated for this looks something like this:
[{"name":"Full Name","id":"1","boss":"Boss's Name"}....];
I was wondering if anyone has come across something like this before. And just to visualize things easier, here is the base code for this page:
//the jQuery was provided in part from http://jsbin.com/avoyu5/1/edit so thanks to
//all who provided such examples to make my life easier!!
<link rel="stylesheet" href="/_layouts/MyProject/css/jquery-ui.css" />
<script src="/_layouts/MyProject/js/jquery-1.8.3.js" type="text/javascript"></script>
<script src="/_layouts/MyProject/js/jquery-ui.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
$function() {
var jsonObj = <%=jsonObject %>; // jsonObject is being filled server-side
$("#<%=txtNames.ClientID %>").autocomplete({
source : function(request, response) {
var matches = $.map(jsonObj, function(val) {
if (val.name.toUpperCase().indexOf(request.term.toUpperCase()) === 0) {
return { name: val.name, id : val.id, boss: val.boss };
}
});
response(matches);
},
select : function (event, ui) {
$("#<%=txtBoss.ClientID %>").val(ui.item.boss);
}
});
});
</script>