[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1005
  • Last Modified:

SHarepoint FieldDescription onchange event

I have a customer who would like to track changes made to a list in sharepoint.  They have several date fields, and want to know what the LAST date was in that field.  We were thinking a solution would be to create a new field that simply stores the last value.

I am trying to create a new field on the "EditItem" page so that when someone changes the value, another field gets auto-populated with the old value.  I was thinking of adding an onfocus, or onchange event - the issue is, I cant seem to figure out how to add the event.  I am okay with the javascript to make that work, but I dont know what part of the field to edit - I am new to sharepoint.

The field's definition looks like the following:

      <SharePoint:FieldDescription runat="server" id="ff21description{$Pos}" FieldName="_x004b_O3" ControlMode="Edit"/><SharePoint:FormField runat="server" id="ff47{$Pos}" controlmode="Edit" fieldname="_x004b_O3" __designer:bind="{ddwrt:DataBind('u',concat('ff47',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@_x004b_O3')}" />

Does anyone know how I can make it so when this field is either brought into focus, or is changed, some javascript executes?

Thanks in advance!
0
jplatt1
Asked:
jplatt1
  • 3
  • 2
1 Solution
 
66866Commented:
Before you go that far, have you investigated versioning? This is an OOTB feature that tracks different version of the same item.
0
 
jplatt1Author Commented:
Thanks 66866 - I actually have not looked into versioning as of yet....the customer wants something pretty specific, and i am not sure versioning will do what I want.  Because sharepoint stores all this stuff in the database, and we have some SSRS reports written based off that already, the idea was to build an ssrs report that would show the items dates changing over time.  I will look into versioning and see if I can get that to do it, but I still think this solution may be better.
0
 
66866Commented:
i am clear with your custom approach, however take a look at the versioning and if you like development you can create reports using SharePoint's API along with versioning.
0
 
jplatt1Author Commented:
Thanks - I have presented this as a solution to the customer, and will see what they think.  

The only potential problem I see - they only really care about when certain fields are changed.  I see the following scenario happening, which could potentially lose some history - say an item is set to hold 10 versions.  If one of the fields we care about gets changed, then 10 other changes come along, the change with the item we care about will get deleted, as only the last 10 versions are saved.  I guess what I really am looking for is versioning settings but only for specific fields.  I know we can set it to keep unlimited versions - that is something I have presented as well.  Will see if he approves of going this route, and if so, will close the question.  Thanks again - you have been a huge help!
0
 
66866Commented:
glad to be of help.
Thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now