I have a list with columns "due date" and "revised date" in SharePoint.

I want to enter the due date column only when I am entering items for the first time. Onclick of save button I want the revised due date to have the value of due date. The revised due date can be editable later but for the first time it should take the value of due date.

How can I achieve this?

1 Answer 1


You have several options to accomplish this:

You can use the server side object model by creating an event receiver that fires on the item added/adding event. The following code will accomplish changing the field value:

var thisItem = properties.ListItem;
var date = DateTime.Parse(thisItem["DueDate"].toString());
thisItem["RevisedDueDate"] = date;

You can use JavaScript to set the value of the revised due date within the PreSaveFunction(). To do so, just modify the newform for the list, and add this to a content editor web part:

function PreSaveAction() {  
    var revised = $("input[title='Revised Due Date']");
        revised.value($("input[title='Due Date']").val());
    return true;

If either field is a required field, then append the title with: " Required Field" (note the space in front of Required Field). So if Due Date was required, it you would use the following selector: $("input[title='Due Date Required Field']")

If you cannot use JavaScript or use Server Side code, then you can use a workflow that runs when an item is created to set the value of Revised Due Date.

  • I tried the javascript code but its disabling the save option of the form.i haven' t tried the server side object code.
    – user29762
    Commented Jun 19, 2014 at 18:11
  • Can I see the code you used? And try PreSaveItems(). I confuse the two all the time.
    – wjervis
    Commented Jun 20, 2014 at 11:35
  • I was not adding the jquery reference before.Now it is working.Thanks a lot.
    – user29762
    Commented Jun 22, 2014 at 12:37
  • if the revised due date field is empty then perform the above code .how to incorporate it in the above code?
    – user29762
    Commented Jul 2, 2014 at 13:31
  • See revision to answer
    – wjervis
    Commented Jul 2, 2014 at 13:47

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.