I am working with a customised list 'editform' and would like to give my users the ability to save their edits without the editform closing, which is the default SP 'Save' behaviour.
I have linked the following code to a HTML button on my form, which appears to be going through the saving motions but refreshing the underlying list shows that the edits made were not saved.
The variable $url is set to '/sites/dev' and the variable $myID is set to the list item ID. The code is getting through to 'oListItem.update();' but no further, without the onQuerySucceeded() or onQueryFailed() functions triggering.
Is there a syntax error in the code?
Thanks
Simon
I have linked the following code to a HTML button on my form, which appears to be going through the saving motions but refreshing the underlying list shows that the edits made were not saved.
function updateListItem() { var clientContext = new SP.ClientContext($url); var oList = clientContext.get_web().get_lists().getByTitle('Manage Recruitment Process Tasks'); this.oListItem = oList.getItemById($myID); oListItem.set_item('Advertisement_x0020_Date', $adDate.val()); oListItem.update(); clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed)); } function onQuerySucceeded() { alert('Item updated!'); } function onQueryFailed(sender, args) { alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace()); }
The variable $url is set to '/sites/dev' and the variable $myID is set to the list item ID. The code is getting through to 'oListItem.update();' but no further, without the onQuerySucceeded() or onQueryFailed() functions triggering.
Is there a syntax error in the code?
Thanks
Simon