Tuesday, February 24, 2009

SharePoint PreSaveAction

You can use below JavaScript function to execute any JavaScript Code in New or Edit Forms for SharePoint List before saving (When Pressing OK button this function will be fired first)

You can use this function for validation before PostBack

    //Add Your JavaScript Code Here Then Return True Or False

    return false; // Cancel the item save process

    return true; // OK to proceed with the save item


  1. Hello,

    Does this function works also with Sharepoint 2003 (WSS 2.0) ? Because I tried in a NewForm.aspx, and it does not seem to work ?

    Thank you for your answer

  2. i did't work with WSS 2.0, but i think it work only in WSS 3.0

  3. Tested in SharePoint 2010 and works.