Link to home
Start Free TrialLog in
Avatar of jplatt1
jplatt1

asked on

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!
ASKER CERTIFIED SOLUTION
Avatar of 66866
66866
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jplatt1
jplatt1

ASKER

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.
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.
Avatar of jplatt1

ASKER

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!
glad to be of help.
Thanks