SPServices Cascade Dropdowns dynamic filter

I have 3 lookup columns.

  1. Site – lookup column to specify type of environment (prod or non-prod)
  2. Operating System – lookup column to specify operating system to be used (linux or windows)
  3. Templates – lookup column that displays list of templates for linux and windows.

Basically, i want to filter the templates base on the type of environment and operating system. i’m using SPServices.SPCascadeDropdowns as solution. the problem is, cascade only works when form is loaded for the first time so in order to select different template whether for linux or windows, form needs to be refreshed. i am new to sharepoint and spservices. appreciate your help on this. below is the code

$  (document).ready(function(){ $  ("select[title='Operating System']").change(function() {     if ($  ("select[title='Operating System']").val() != 2)     {     queryCAML = "<Eq><FieldRef Name='Operating_x0020_System'/><Value Type='Lookup'>Windows</Value></Eq>",     osType()     }     else     {     queryCAML =  "<Eq><FieldRef Name='Operating_x0020_System'/><Value Type='Lookup'>Linux</Value></Eq>",     osType()     } });  


function osType() {     var osValue = $  ("select[title='Operating System'] option:selected").text();             alert (osValue);             alert (queryCAML);             $  (document).ready(function(){             $  ().SPServices.SPCascadeDropdowns({                 relationshipList: "TEST VM Templates",                 relationshipListParentColumn: "Site",                 relationshipListChildColumn: "Template",                 CAMLQuery: queryCAML,                 parentColumn: "Site",                 childColumn: "Template",                 debug: true             })         });  }  

Having trouble with SPServices AutoComplete pulling from specific columns

I have 2 issues really. I have set this up successfully for some of my fields on my Nintex form. The autocomplete works perfectly.

Issue 1: I attempted to set this up on another field on another list. The field will not find anything when you start typing. I thought possibly I had the wrong crawled property, but I tried everything I could think of with no success.

Issue 2: I attempted to use a different column from the second list from Issue 1 to see if it was a column issue. I did get results, but they were not correct. In fact, I am unable to find ANYWHERE that the information in the auto-correct is displaying.

I can get the field to work if I connect it to the same columns as the other fields that are working. So it doesn’t appear to be a field or code issue. It seems that it either doesn’t like the list or the specific column.

I also tried to create a completely new list with column names I know are not being used anywhere else in our farm, but this didn’t work either.

I have no idea what’s going on. It’s quite puzzling. Below is my code.

NWF$  (document).ready(function() { //The source data for the autocomplete is the Journals list   //Store the journal titles in a array variable   var externalParties = []; NWF$  ().SPServices({     operation: "GetListItems",     async: false,     listName: "Vendor IDs",     CAMLViewFields: "<ViewFields><FieldRef Name='Vendor Name' /></ViewFields>", //the name needs to be changed accordingly        completefunc: function(xData, Status) {         NWF$  (xData.responseXML).SPFilterNode("z:row").each(function() {             externalParties.push(NWF$  (this).attr("ows_VendorName").substring(8));         });     } }); //journalinput is added on the control in the NF   NWF$  ("#" + journalinput4).autocomplete({     source: externalParties }); }); 

Spservices autocomplete with many columns

Could somebody advise how can I make autocomplete for multiple columns, currently I’m using it for one column:

$  ().SPServices.SPAutocomplete({     sourceList: "My list",     sourceColumn: "Email",     columnName: "user1",     ignoreCase: true,     numChars: 3,     slideDownSpeed: 1000,     debug: true }); 

Can I do something like this:

... columnName: "user1", "user2", "user3"... etc. ... 


My form and JavaScript looks like this:

<div class="tr">   <div class="td">     <input title="user1" data-bind="textInput: user1Email, valueUpdate:'blur'" />   </div> </div> <div class="tr">   <div class="td">     <input title="user2" data-bind="textInput: user2Email, valueUpdate:'blur'" />   </div> </div>  <script type="text/javascript"> $  (document).ready(function () {     $  (["user1", "user2", "user3"]).each(function () {         $  ().SPServices.SPAutocomplete({             sourceList: "User List",             sourceColumn: "Email",             columnName: this,             ignoreCase: true,             numChars: 3,             slideDownSpeed: 1000,             debug: true         });     }) }); </script> 

CAML queries suddenly quit working; SP Online; SPServices

I have CAML queries performed against SharePoint Online lists through SPServices that have worked beautifully for 5 years. Sometime in the last couple of weeks they started returning incorrect results. The problems all seem to be oriented around the “EndOfLife” text field which always contains a “1” or a “0” (without the quotes).

<Where>   <Eq>     <FieldRef Name='EndOfLife'></FieldRef>     <Value Type='Text'>1</Value>   </Eq> </Where> 

Executed through SPServices in the browser, this query against a particular list returns 10 results. The same query against the same list executed through U2U CAML Query Builder returns over 900 results.

Executed against a different list in another site collection, that query returns 3 results through SPServices in the browser and 2000 results through U2U CAML Query Builder.

There are no changes on my end that correlate with the timing of these problems.

Any idea why these queries executed through SPServices in the browser would suddenly be returning incorrect results?

SharePoint SPServices query and sum list items

I have 3 dropdown menus, in those 4 fields I have choices to query a SharePoint 2010 list using SPServices

Dropdown filters are: Year, Month, Company List fields are: Year, Month, Company, Department

What I want is to filter the retrieved items based on the values of that 4 dropdowns and then with the result sum all values in the field Department

        $  ().SPServices({         operation: "GetListItems",         async: false,         listName: "List guid",          viewName: "View guid",         CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='Department' /></ViewFields>",         completefunc: function (xData, Status) {             $  (xData.responseXML).SPFilterNode("z:row").each(function() {                 var liHtml =$  (this).attr("ows_Title");                 var Department=$  (this).attr("ows_Department");         }     }); 

How can I only retrieve the filter items and sum the values of that field, CAMLQuery ?

SPServices UpdateListItems not working

I created a list called testlist then I created a html within the same site with the following layout

<table> <tr> <td><strong>List Item to be added</strong></td> <td><input id="txtTitle" name="txtTitle" type="text" /></td> </tr><tr> <td><input name="ADD" id="btnADD" type="submit" value="Add Item to List" /></td></tr> </table> <script src="jquery 1.11.1 stored in my library"></script> <script src="SPServices SPServices 2014.01 stored in my library"></script> <script type="text/javascript">          $  (document).ready(function () {              $  ("#btnAdd").click(function () {                 var title = $  ("#txtTitle").val();                 AddListItem(title);             });          });          function AddListItem(TitleField) {             $  ().SPServices({                 operation: "UpdateListItems",                 async: false,                 batchCmd: "New",                 listName: "testlist",                 valuepairs: [["Title", TitleField]],                 completefunc: function (xData, Status) {                     alert("Data Saved! and Please check your List");                 }             });         }     </script> 

When I type TESTER in the box and push submit it does not enter in a new item into the list. Is there something I’m missing?

Display only a substring of values returned from SPServices SPAutocomplete function

I’m using SPAutocomplete from SPServices because I have a requirement to make a searchable lookup field rather than an OOTB lookup field (drop down menu), as there is potential for thousands of values in the source column. It’s working fine, except it’s displaying “string;#” before the value, and I need only the value to appear for each option.

enter image description here

Here is my code:

<script      src="https://code.jquery.com/jquery-3.3.1.js"      type=text/javascript> </script>  <script      src="https://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.02/jquery.SPServices.js">     type=text/javascript> </script>   <script type="text/javascript">      $  (document).ready(function () {          $  ().SPServices.SPAutocomplete({             sourceList: "{C9AF367D-2CA1-40EE-B0AE-99CFDSAF6543389}",             sourceColumn: "Reported_x0020_Tracking_x0020_Number",             columnName: "Tracking Number",             ignoreCase: true,             filterType: "Contains",             numChars: 1,             uniqueVals: true,             slideDownSpeed: 'fast'         });          $  ("select[id^='Tracking_x0020_Number'] > option").each(function () {         {         $  (this).val(this.substring(9));         }          });      });  </script> 

I can’t get the each function to display only the substring I want properly. I am beginner level with JQuery (actually a data scientist – but have been required to create custom lists for data collection purposes).

Any help is greatly appreciated!

Bind the DateTimeField field with Today’s date using SPServices and jQuery

How to bind the DateTimeField field with today’s date using SPServices and jQuery? I can’t use the default Today to set the column in the Sharepoint UI to use Today’s Date as the default value in my SharePoint 2010 SPList. My date field control name is: Request Received Date

When the newform.aspx is loaded, I need to bind this field with today’s date.

  <script type="text/javascript">  _spBodyOnLoadFunctionNames.push("setRequestEndTime");   // Set the Request End Time to today's date    function setRequestEndTime()  {    var d = new Date();  d = (d.getMonth() + 1).toString()   + "/" + d.getDate().toString()   + "/" + d.getFullYear().toString()  + " " + d.getHours().toString()  + ":" + d.getMinutes().toString()     + ":" + d.getSeconds().toString();  //alert(d);     today = new Date();        todayDay = today.getDate();        todayMon = today.getMonth() + 1;        todayYear = today.getYear();        //alert('setRequestEndTime');        var tags = document.getElementsByTagName('input');        for (var i=0; i < tags.length; i++)      {            //alert(' tags[' + i + '].id=' + tags[i].id);            if(tags[i].id.indexOf('ff2_new') > 0)          {              //alert('HIT tags[' + i + '].id=' + tags[i].id);                tags[i].value = todayMon + "/" + todayDay + "/" +            todayYear;            }        }      }   </script> 

I tried to add the above code refer: (http://sympmarc.com/2009/05/20/pre-filling-column-values-in-a-sharepoint-form/”) in a content editor web part. but I didn’t get the value assigned to the datetime field. Sorry for my JavaScript skills, am unable to get what’s meant by ff2_new.


  <script type="text/javascript">   var $  j = jQuery.noConflict();   function PreSaveAction()   {     alert("here..........");   var txtDueDate = $  j(":input[title='Due By']").val();   var txtReqstRecvdDate = $  j(":input[title='RequestReceivedDate']").val();  } 

here the requestrecvdate is my today’s date. if i set the todays date value, i am getting “undefined” here. so i am unable to compare the txtduedate with the requestrecvdate. Hence I am trying to bind the today’s date with the requestrecvdate field instead of setting the column-settings–> Today’s Date

Getting ALL Recurrsive Items from Sharepoint 2010 Calendar List using SPservices

Is there is any CAML quey to fetch all the recurring events from SharePoint 2010 Calendar List. i.e not for single year or month. Eusing the <DateRangeOverlap> CAML query we can get events of today, Month & year . but we need to get all the recurring events from the calendar list.

We tried the following CAML query to get recurrence events for a month:

var nextdate=yy+'-'+mm+'-'+dd+timeZone   CAMLViewFields: "<ViewFields>" +       "<FieldRef Name='ID' />"+             "<FieldRef Name='Title' />" +             "<FieldRef Name='EventDate' />" +             "<FieldRef Name='EndDate' />" +             "<FieldRef Name='Location' />" +             "<FieldRef Name='Dept' />" +             "<FieldRef Name='Description' />" +             "<FieldRef Name='fRecurrence' />" +             "<FieldRef Name='RecurrenceData' />" +             "<FieldRef Name='fAllDayEvent' />" +         "</ViewFields>",  CAMLQuery: "<Query>" +                     "<Where>" +                     "<DateRangesOverlap>" +                             "<FieldRef Name='EventDate' />" +                             "<FieldRef Name='EndDate' />" +                             "<FieldRef Name='RecurrenceID' />" +                             "<Value Type='DateTime'>" +                                 "<Month/>" +                             "</Value>" +                 "</DateRangesOverlap>" +                 "</Where>" +                 "<OrderBy>" +                         "<FieldRef Name='EventDate' />" +                 "</OrderBy>" +                 "</Query>",  CAMLQueryOptions: "<QueryOptions>" +               "<CalendarDate>"+nextdate+"</CalendarDate>" +             "<RecurrencePatternXMLVersion>v3</RecurrencePatternXMLVersion>" +             "<ExpandRecurrence>TRUE</ExpandRecurrence>" +         "</QueryOptions>",        

If possible please share the code to get events between specific date(i.e from & to dates).