Wednesday, July 25, 2012

SharePoint 2010 Tip - Hiding Save Button on Edit Ribbon

This took me a little time to compose, having encountered some difficulties finding a suitable answer in forums. My goal was to block a user's ability to use the "Save" and "Cancel buttons on the Edit ribbon.
The reason being, is that I wanted to control customized behaviors when a form was submitted. This Save button bypasses custom actions. I isolated the span id containing the Save and Cancel buttons, then created a similar Master page including the following code:

function nullSaveBtn()
{
document.getElementById('Ribbon.ListForm.Edit.Commit-LargeLarge').style.display='none';
}
The function, is of course called from the onload handler. The result is quite satisfying.

No comments:

Post a Comment