none
Hide button in ribbon bar in dispform.aspx RRS feed

  • Question

  • Is there any way to hide or remove the "Edit Item" button in the ribbon bar of the dispform.aspx in a single list? I know that giving the user "read only" permission would grey out the button but this is not the intended approach.

    Hiding the complete ribbon bar in this particular dispform.aspx would be a solution too.

    Any idea?

    Thursday, April 25, 2013 11:40 AM

Answers

  • Hello,

    You can hide a single button from the ribbon.

    I've done this in Sharepoint 2013 like this:

    -on your display page go into page edit mode

    -insert Script Editor web part and add this following script to it:

    <script type="text/javascript">
        function hideEdit() {
            var edit = document.getElementById("Ribbon.ListForm.Display.Manage.EditItem-Large");
            edit.style.display = "none";
        }       
        _spBodyOnLoadFunctionNames.push("hideEdit");
    </script>

    Hope this helps,


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Blog: My SharePoint Insight

    • Marked as answer by Ragescho Thursday, April 25, 2013 1:31 PM
    Thursday, April 25, 2013 12:56 PM

All replies

  • You should be able to hide the complete ribbon bar using JQuery or JavaScript by finding the ID of the surrounding <DIV> and setting its CSS Display style to None.

    But there really is no way to hide a single button in the ribbon.  By definition Ribbon buttons can be enabled and disabled, but they aren't supposed to be removed.


    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

    Thursday, April 25, 2013 12:14 PM
  • Hello,

    You can hide a single button from the ribbon.

    I've done this in Sharepoint 2013 like this:

    -on your display page go into page edit mode

    -insert Script Editor web part and add this following script to it:

    <script type="text/javascript">
        function hideEdit() {
            var edit = document.getElementById("Ribbon.ListForm.Display.Manage.EditItem-Large");
            edit.style.display = "none";
        }       
        _spBodyOnLoadFunctionNames.push("hideEdit");
    </script>

    Hope this helps,


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Blog: My SharePoint Insight

    • Marked as answer by Ragescho Thursday, April 25, 2013 1:31 PM
    Thursday, April 25, 2013 12:56 PM
  • it is possible to do this in CSS:

    <style type="text/css">
    #Ribbon\.ListItem\.Manage\.EditProperties-Large
    {
    display: none !important;
    }
    </style>


    /blog twttr @esjord

    Thursday, April 25, 2013 1:06 PM
  • Hello,

    You can hide a single button from the ribbon.

    I've done this in Sharepoint 2013 like this:

    -on your display page go into page edit mode

    -insert Script Editor web part and add this following script to it:

    <script type="text/javascript">
        function hideEdit() {
            var edit = document.getElementById("Ribbon.ListForm.Display.Manage.EditItem-Large");
            edit.style.display = "none";
        }       
        _spBodyOnLoadFunctionNames.push("hideEdit");
    </script>

    Hope this helps,


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.


    Awsome. Thats exactly what I was looking for. Thanks a lot.
    Thursday, April 25, 2013 1:34 PM
  • When I tried using this code, it hid the entire ribbon.
    Thursday, November 6, 2014 12:08 AM
  • How do I manipulate this to remove other tabs like Version History or Delete Item, etc?

    Thanks,

    stH


    stH

    Thursday, May 7, 2015 9:21 PM
  • This addresses my issue completely - thank you!
    Thursday, June 8, 2017 3:43 PM