views:

7

answers:

1

I am running WSS3.0 and have a custom list which contains versioning on a couple of fields. When I click on an item and I view the item page I see the history of all the fields which I have made changes to. This works fine as expected.

I have also created a page using Microsoft Office Sharepoint Designer and using a DataFormWebPart I have created a page that shows all the items in the list in a list view, I have also changed the XSL node of the DFWP to display the datain a way that my client wants.

The issue that I have is, it is only showing the latest version of the item record e.g. some of the fields are blank as the client did not update those fields the last time that the item was saved. I can fully understand why it is not showing these previous versions of the item but is there anyway that I can change an option in the webpart that will return that last non blank version of the field?

If this is not possible does anybody know if it is possible to change the edit page for the item so that it defaults certain fields to have the previous value of the field.

Many thanks for you ideas in advance

Jonathan

A: 

I eventually was able to add the following jQuery code at the bottom of the page (using Sharepoint Designer). You will also need to add a link at the top of the page to include a link to the jQuery code (or you can install it as a feature).

<script>
jQuery.fn.GetLastUpdate = function () { 
  $updates = this.parent().next().clone();
  $("nobr", $updates).remove();
  $("a", $updates).remove();
  $("br", $updates).remove();
  $lastUpdate = $updates.text().split("(): ")[1]; //.find("a").replaceWith("##++##").text();
  this.text($lastUpdate);
  return $lastUpdate;
}

$("[title='CONTROL_TITLE']").GetLastUpdate();
</script>

Then you just have to replace the CONTROL_TITLE with the title of the text box that you want to auto fill.

Jonathan Stanton