Thursday, October 1, 2015

How to Bind drop down list field from SharePoint List Using SPServices?

 Please add jQuery min file and SPServices script file
Jquery
<script type="text/javascript">
 $(document).ready(function() {

  var keywordQuery= "<Query><Where><Eq><FieldRef Name='Title' /><Value Type='Text'>"+dtype +"</Value></Eq></Where></Query>";
 $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "Keywords",
    CAMLQuery: keywordQuery,
     completefunc: function (xData, Status) {
      $(xData.responseXML).SPFilterNode("z:row").each(function() {

$("#ddltype").append("<option>"+$(this).attr("ows_txt_KeywordValues") +"</option>");
});
}
});
});
</Script>


HTML

<select id="ddltype" class="hillbillyForm" data-displayName="cmb_item"></select>

No comments:

Post a Comment