Add additional Javascript code on OOTB sharepoint ribbon button.

Hello,

We have SharePoint Ent and Project Server 2010 SP-2 environment.

So the requirement is like that we have 1 OOTB "Save" ribbon button for Project Server 2010 Project Detail Pages. Which actually Saves and Publishes the project updates into Project Server database.

Here I have to execute javascript code basically to refresh the page right after user click OOTB "Save" button and Projects gets saved into database.

But here I am not getting any pointer how to add this additional Javascript code into commandaction of existing OOTB "Save" ribbon button, so that my Project gets save and publish and also I'll be able to refresh the page right after the save and publish.

Please help me let me know how can i hook into OOTB SharePoint ribbon button actions.

Thanks !!!

January 13th, 2014 7:58am

Hi,                                                             

It will not easy to add actions to an OOTB ribbon button, there is a workaround that we can replace it with a custom button.

Here is a documentation about Replacing a Button on the Server Ribbon:

http://msdn.microsoft.com/en-us/library/ff407619.aspx

Another two links about create a custom ribbon button for your reference:

http://msdn.microsoft.com/en-us/library/office/ff407458(v=office.14).aspx

http://sharepoint.stackexchange.com/questions/20646/attach-a-javascript-function-to-an-ootb-ribbon-button

Best regards
Free Windows Admin Tool Kit Click here and download it now
January 14th, 2014 2:31am

Thanks Patrick for valuable inputs,

I do have 1 question, as you suggested instead of adding actions to OOTB ribbon button, I should develop custom ribbon button. So in that custom button can I add my OOTB button's default functionality (i.e save and publish project in Project Server) along with my custom java-script code to refresh page.

If yes can please suggest me any helpful post and links.

Thanks !!!

January 14th, 2014 5:18am

Hi Sachin,

I am not sure what type of form you are using by seeing the screenshot.  

If it is normal list form, Did you try 'PreSaveAction()' out-of-the-box JS method, which can be used to execute your own JavaScript before 'Save' action.

Refer these links http://spandps.com/2011/01/25/useful-javascript-function-presaveaction-sp2010-sharepoint-ps2010-projectserver-in/

http://replicrux.com/2011/11/09/validating-forms-in-sharepoint.aspx

Hope that helps.

Free Windows Admin Tool Kit Click here and download it now
January 14th, 2014 6:54am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics