Hi,
Trying to get jQuery autocomplete plugin working on CRM 2013 custom entity field.
Added WebResources to custom entity's form properties:
•jquery.js
•jquery_ui.js
•autocomplete_customfield.js
Added event handler to custom entity's onLoad event, invoking function InitAutoComplete (from autocomplete_customfield.js), passing parameter to it "contoso_title".
Here is autocomplete_customfield.js code:
function InitAutoComplete(TextBoxName)
{
(function($){
$('head').append('<link rel="stylesheet" href="http://crm2013/WebResources/eb_jquery.ui.css" type="text/css" />');
$(document).ready(function ()
{
$('#' + TextBoxName).bind('keydown', function (event)
{
if (event.keyCode === $.ui.keyCode.TAB &&
$(this).data('ui-autocomplete').menu.active)
{
event.preventDefault();
}
}).autocomplete({
minLength: 0,
source: function (request, response)
{
response($.ui.autocomplete.filter(['Apples', 'Oranges', 'Bananas', 'Grapes', 'Tomatoes', 'Mango'], request.term));
},
position:
{
my: 'left top',
at: 'left bottom',
of: $('#' + TextBoxName)
}
}).css('z-index', 999999);
$('.ui-autocomplete').css('max-height', '100px');
$('.ui-autocomplete').css('max-width', '600px');
$('.ui-autocomplete').css('overflow-x', 'hidden');
$('.ui-autocomplete').css('overflow-y', 'auto');
$('#' + TextBoxName).focus
(
function ()
{
$(this).autocomplete('search', $(this).val());
}
);
});
})(window.crmjQuery);
}
Code is taken from http://nathanielmnelson.com/node/29. Other examples were also tried (standart jquery autocomplete code, etc).
Also recommendations from http://www.develop1.net/public/post/jQueryNamespacing.aspx are taken into account.
CRM text field does not react. It works as a standard text field with no jquery drop down suggestions. Only when you press "enter" on a field it gives you a full list of suggestions (but this list is not active as you type, and is never filtered by inserted characters). It seems that CRM 2013 standard form javascript/css (or DOM tree) has some problems with custom jquery autocomplete functionality.
Any ideas?