4

In my sharepoint 2013 list dispform.aspx, I have one webpart with 'save' button . Once that save button is clicked i want to disable the 'Edit Item' OOTB option from the ribbon . How can i achieve that using javascript

3
  • you can use PowerShell using CSOM framework. That's the recommended approach.
    – samolpp2
    Commented Jan 25, 2016 at 6:27
  • @samolpp, PowerShell from a custom action seems overcomplicated Commented Jan 25, 2016 at 6:36
  • @RobertLindgren , I have provided the answer using js , below. mohammed, you can try the below solution.
    – samolpp2
    Commented Jan 25, 2016 at 6:50

3 Answers 3

3

Insert Script editor webpart and on click on the button add and call this function

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

https://social.technet.microsoft.com/Forums/office/en-US/d10c9895-a9c7-4189-a312-d20664d94dfc/hide-button-in-ribbon-bar-in-dispformaspx?forum=sharepointgeneral

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

Another approach : You can have a look at here

2
  • When copy pasting code from a source (this one I guess; social.technet.microsoft.com/Forums/office/en-US/…) you must make that very clear in your answers, to give proper credit to the author Commented Jan 25, 2016 at 7:26
  • Mohammed, I think,I have given you the answer, so you can mark my reply as an answer.
    – samolpp2
    Commented Jan 25, 2016 at 7:59
0

To disable the edit item menu.

  1. Go to settings >> edit page
  2. click the drop-down >> Edit Web Part (see diagram below) Editing web part

  3. On the list views dialog box; Go to toolbox type >> select No Toolbar (see diagram below) list views dialog box

  4. Apply >> Ok to Save.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.