I have javascript to update the item title which loads while displaying the form(display form), the item is updating fine but till I refresh the page only, not while loading the view item

Here is the written code

var clientContext = SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle('Test_Versioning');

var oListItem = oList.getItemById(itemID);
oListItem.set_item('Title', 'My Updated Title New1');
oListItem.set_item('Editor', userid);
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());

1 Answer 1


try to using this fuction, all your code will be execute after loading

< !--#_

AddPostRenderCallback(ctx, function(){ });

_#-- >

sorry for my last response, i was not read good

  • i changed the response, i wasn't read good, i m sorry Feb 10, 2016 at 16:35

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.