I have a js file which retrieves a value stored in a date field and then calculates the remaining time in weeks/days. My issue is that this works on the edit form because I send the value in with MyColumn.val('value here'), but I have no clue where to begin doing the same thing on the display form.

I have two options:

  1. Modifying the display so that the column would show:

Days Left: [my js result here]

  1. Placing a line of text above the created/modified info at the bottom (preferred?) (Above here: disp

Which option would be easier to transfer using the existing code from the CEWP on the edit form?

Thank you!

  • It will also work in the form of display, but in the add and edit forms, you get the column values​​. You display form, you should get .Text() of <tr> where the date is, at this from an id to this tr. Feb 17, 2014 at 17:37

1 Answer 1


In SharePoint 2010, the default display forms include an anchortag in the table rows with a name attribute of:


If you are using those default display forms, you can take advantage of this and locate your values using jQuery like the following. In this example, my date field is named 'SiteCreateDate':

// my example list field is named SiteCreateDate

// this will fetch the value:
var myDateValue = $('a[name*=SPBookmark_SiteCreateDate]').closest('tr').children().eq(1).text().trim();

// do your days left calculation here
myDateValue = myDaysLeftFunction(myDateValue);

// this will append a new tablerow below the initial date row with your new value
$('a[name=SPBookmark_SiteCreateDate]').closest('tr').after('<tr><td class="ms-formlabel"><h3 class="ms-standardheader">Days Left</h3></td><td class="ms-formbody">' + myDateValue + '</td></tr>');

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.