After a user uploads a document the editform.aspx page is displayed. I need to force an update even if Cancel button is selected within the default editform.aspx form of a library. I know there is a preSaveAction function for save, is there a preCancelAction I can call to execute additional code on a cancel? Has anyone tried to force additional code to run even if the user selects cancel button within the default editform? Do i have to maybe capture that buttons event? What is that event? I have been searching and nothing found that matches what I want to do. I have successfully populated custom fields on the form so when the user selects save all is saved but when a user selects cancels i need some of the fields to still store the information. I tried and wrote code to do the save when the editform loads and it works great, but then if the user selects save i get error that the file is already updated by user. so i only want the code to run if i hit Cancel. Help!!!
<script type="text/javascript">
$(window).load(function(){
    try
    {
        // set custom fields on form so when user selects Save button these values are saved.  works great.
    // I can also save the items here as well using code below and when i select cancel they are saved.
    // but when I select save button I get an already saved error...  so i moved to only when hit cancel button below.
    }catch(ex)
    {
        alert(ex.toString());
    }
});
$(document).ready(function(){
    $(":button[value='Cancel']").click(function(){
    var context = SP.clientContext.get_current();
    var web = context.get_web();
    var listId = _spPageContextInfo.pageListId;
    var itemId = parseInt(GetUrlKeyValue('ID'));
    var list = web.get_lists().getById(listId);
    var listItem = list.getItemById(itemId);
    var urlValue = new SP.FieldUrlValue();
    urlValue.set_url(url);
    urlValue.det_description(descValue);
    listItem.set_item('Action',urlValue);
    listItem.set_item('ActionId',descValue);
    listItem.update();
    context.ExecuteQuery();
    });
});
</script>