1

I am getting the error, "Input list was not in correct format error"

My sharepoint list has single text fields so i cannot see the problem

  function savingsdatick(varid) {
  //Get Current Tabs before submission
  var allTicksForSave = {};
  $(".thischeck").each(function () {
   allTicksForSave[$(this).attr("id")] = $(this).is(":Checked")
 });
  console.log("So...")
  console.log(allTicksForSave)

  var Tickbox1 = "Tickbox1";
  var Tickbox2 = "Tickbox2";
  var Tickbox3 = "Tickbox3";
  var Tickbox4 = "Tickbox4";
  var Tickbox5 = "Tickbox5";
  var Tickbox6 = "Tickbox6";
  var Tickbox7 = "Tickbox7";
  var Tickbox8 = "Tickbox8";
  var Tickbox9 = "Tickbox9";
  var Tickbox10 = "Tickbox10"
  var Tickbox11 = "Tickbox11";
  var Tickbox12 = "Tickbox12";
  var Tickbox13 = "Tickbox13";
  var Tickbox14 = "Tickbox14";
  var Tickbox15 = "Tickbox15";
  var Tickbox16 = "Tickbox16";
  var Tickbox17 = "Tickbox17";
  var Tickbox18 = "Tickbox18";
  var Tickbox19 = "Tickbox19";
  var Tickbox20 = "Tickbox20";
  var Tickbox21 = "Tickbox21";
  var Tickbox22 = "Tickbox22";
  var Tickbox23 = "Tickbox23";
  var Tickbox24 = "Tickbox24";
  var Tickbox25 = "Tickbox25";
  var Tickbox26 = "Tickbox26";
  var Tickbox27 = "Tickbox27";
  var Tickbox28 = "Tickbox28";
  var Tickbox29 = "Tickbox29";
  var Tickbox30 = "Tickbox30"; 


      var varid = localStorage.getItem("projectnewTitle");
      var currentStorm = document.getElementById("dale3").innerHTML;
      var siteUrl = _spPageContextInfo.webServerRelativeUrl;
      var clientContext =  SP.ClientContext.get_current();
      var oList = clientContext.get_web().get_lists().getByTitle('SecurityDesignAssuranceLeft');
      this.oListItem = oList.getItemById(currentStorm)
        if(allTicksForSave.SDALEFTBOX0) oListItem.set_item('Tickbox1', 'True');
        if(allTicksForSave.SDALEFTBOX1) oListItem.set_item('Tickbox2', 'True');
        // if(allTicksForSave.SDALEFTBOX2) oListItem.set_item(Tickbox3, "True")
        // if(allTicksForSave.SDALEFTBOX3) oListItem.set_item(Tickbox4, "True")
        // if(allTicksForSave.SDALEFTBOX4) oListItem.set_item(Tickbox5, "True")
        // if(allTicksForSave.SDALEFTBOX5) oListItem.set_item(Tickbox6, "True")
        // if(allTicksForSave.SDALEFTBOX6) oListItem.set_item(Tickbox7, "True")
        // if(allTicksForSave.SDALEFTBOX7) oListItem.set_item(Tickbox8, "True")
        // if(allTicksForSave.SDALEFTBOX8) oListItem.set_item(Tickbox9, "True")
        // if(allTicksForSave.SDALEFTBOX9) oListItem.set_item(Tickbox10, "True")
        // if(allTicksForSave.SDALEFTBOX10) oListItem.set_item(Tickbox11, "True")
        oListItem.update();
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded4), Function.createDelegate(this, this.onQueryFailed4));
    function onQuerySucceeded4() {
    alert("Hi")
  }

  function onQueryFailed4(sender, args) {
    alert("Failed" + args.get_message())
  }
}
2
  • Are there mandatory fields in the list, where you are not setting any values? And by default it is taking a null/empty string? Commented Jul 9, 2020 at 4:53
  • Unfortunately not, i know the Title Field is always mandatory but this is set, I am unsure what else it could be? any ideas?
    – Dale
    Commented Jul 9, 2020 at 10:36

1 Answer 1

1

Can you confirm that the currentstorm variable contains a valid integer, and not any extra html.

You might need to use innerText instead.

2
  • Hi James thanks for making me check this, storm was not a valid integer, so when I was trying to get item id, it was throwing this error. What I did instead was rest API to get SharePoint ID row and then got item ID this way :)
    – Dale
    Commented Jul 10, 2020 at 21:53
  • Glad you got it sorted. May you please Mark as Answer or upvote, so it can benefit others. Commented Jul 12, 2020 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.