2

I am entering values in a List using ClientContext. The list has around 70 columns.

I get an error at Executequeryasync in Chrome but works fine in IE. I am able to submit in the list from IE.

I removed the below section of codes around 25, then I am able to submit in chrome.

function createListItem() {
context = SP.ClientContext.get_current();
var airportList = context.get_web().get_lists().getByTitle(listTitle);
var listItemCreationInformation = new SP.ListItemCreationInformation();
var listItem = airportList.addItem(listItemCreationInformation);       
listItem.set_item('Column1', document.getElementById("txtarea_cmt1").value);

listItem.set_item('Column67', document.getElementById("txtarea_cmt67").value);

ListItem.update();
clientContext.load(ListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
function onQuerySucceeded() {
alert('Item created: ' + oListItem.get_id());
}

function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}

When i enter all 67 columns it gives error : "Request Failed. Unexpected response from server. The status code of response is 0. The status text of respose is ''.null". It works when when i enter around 55 columns. [Note : There is no reload happening on submit button.]

  • what's the error you got in chrome? please add your code to can help u faster ? – Mohamed El-Qassas MVP Sep 5 '17 at 17:28
  • i have added code and error. hope that helps – Joy D'souza Sep 6 '17 at 10:06
  • This is because of the column not having proper data. I'll suggest you to categorize your fields based on type. All the text fields at one place followed by choice, followed by yes/no etc. etc. In this way you can identify from which column type is causing you problem. – ThinkB4Code Sep 6 '17 at 11:08
  • Thanks for your answer. There is no problem in column. It gets submitted in IE. – Joy D'souza Sep 7 '17 at 12:40
  • it is the ready function which causes this error. there is some code to fetch data from SP list in ready fun. when i remove ready func it works – Joy D'souza Sep 8 '17 at 12:27
0

This got solved by using REST API.

There were some other functions working on page load which caused problems with ASYNC ClientContext.

Your Answer

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

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