SHarepoint FieldDescription onchange event

Posted on 2011-04-21
Last Modified: 2012-05-11
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!
Question by:jplatt1
    LVL 21

    Accepted Solution

    Before you go that far, have you investigated versioning? This is an OOTB feature that tracks different version of the same item.

    Author Comment

    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.
    LVL 21

    Expert Comment

    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.

    Author Comment

    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!
    LVL 21

    Expert Comment

    glad to be of help.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Note:  There are two main ways to deploy InfoPath forms:  Server-side and directly through the SharePoint site.  Deploying a server-side InfoPath form means the form is approved by the Administrator, thus allowing greater functionality in the form. …
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now