In this below script, Auto populate dropdown in SharePoint List using SPServices
<input type="text" id="txtsearch" onkeyup="binddetails()">
Code:
function binddetails()
{
availableTags = [];
$().SPServices({
operation: "GetListItems",
async: false,
listName: "Keywords",
CAMLQuery: "<Query><Where><Contains><FieldRef Name='Title' /><Value Type='Text'>"+$("#txtsearch").val()+"</Value></Contains></Where></Query>",
CAMLViewFields: "<ViewFields Properties='True' />",
completefunc: function(xData, Status) {
var ktop = "";
$(xData.responseXML).SPFilterNode("z:row").each(function() {
var titl = "N/A";
if ($(this).attr("ows_Title") != null) {
// titl = ;
availableTags.push($(this).attr("ows_Title"));
}
});
}
});
$("#txtsearch").autocomplete({
source: availableTags
});
}
No comments:
Post a Comment