I am using html drop-down to get the data for it dynamically from SharePoint list.

Also, I required to trigger the query on change of option for this drop-down. I am not even getting the "Alert" message. Can any one help what's wrong in my control.I assume the issue is in control.

<select id="drbfunction" class="select" onChange="getFiltermonths()";>
         <option selected="selected">Select</option>

function getFiltermonths()
  alert("in Filter Months function");
var mymonthvalue=document.getElementById("drbfunction").value;
  var clientContext = new SP.ClientContext.get_current();
  var oList = clientContext.get_web().get_lists().getByTitle('MyTableTopSessions');

  var camlQuery = new SP.CamlQuery();
  camlQuery.set_viewXml("<View><Query><Where><Eq><FieldRef Name='Title' /><Value Type='Text'>"+mymonthvalue+"</Value></Eq></Where></Query></View>");

  this.collListItem = oList.getItems(camlQuery);
  clientContext.executeQueryAsync( Function.createDelegate(this, this.onQuerySucceeded),Function.createDelegate(this, this.onQueryFailed) );
  • Check in console if you are getting any error message. – Rohit Waghela Mar 3 '18 at 8:02
  • Also I do not see any reason to not work this code. getFiltermonths function should be called on onChange event. – Rohit Waghela Mar 3 '18 at 8:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.