In my recent assignment I have gone through to achieve  auto complete  functionality in a page .

/JQueryLibrary/JqueryLatest2.1.4.js”>

http://ursiteurla%20href=

//code.jquery.com/ui/1.11.4/jquery-ui.js

<link rel=”stylesheet” href=”//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css”/>

window.onload = function() {

window.setTimeout(readyCall, 1000);

}

function readyCall(){

var externalParties = [];

$().SPServices({

operation: “GetListItems”,

listName: “Period”,

CAMLViewFields: “”,

async: false,

completefunc: function (xData, Status) {

$(xData.responseXML).SPFilterNode(“z:row”).each(function() {

//alert($(this).attr(“ows_PeriodId”));

externalParties.push({“label”:$(this).attr(“ows_PeriodName”),”value”:$(this).attr(“ows_PeriodName”),”id”:$(this).attr(“ows_PeriodId”)});

//externalParties.push($(this).attr(“ows_PeriodName”));

});

}

});

$(‘#name’).autocomplete({

source: externalParties,

minLength: 1,

select: function (event, ui)

{

//alert(ui.item.value);

$(‘#id’).val(ui.item.id);

}

});

}

 

Reference :

http://www.codeproject.com/Articles/152558/jQuery-UI-Autocomplete-with-ID

http://sympmarc.com/2011/08/24/using-spservices-with-jqueryuis-autocomplete-function-on-infopath-forms-in-sharepoint/

 

 

Advertisements