How to disable or hide the Attachment upload on a List's New form RRS feed

  • Question

  • Hello,

    I am using Sharepoint 2010 and have a custom New form for my List.  I want to hide (or disable) the "Attach File" from the ribbon but can't find a way to do it.  In my javascript that runs when the page is loaded, I can get a handle to the <a> tags (2 of them) that call the Sharepoint UploadAttachment function as well as can get a handle to the <img> for the icon, but cannot find a way to hide the parent <tr> or <table> (or even just hide the image).  Not sure what I may be missing.  Not sure if it could be related to my code maybe getting called before the Sharepoint _initTRAWebPartWPQ1 which looks like it deals with the toolbar.

    Any thoughts on this one? - Peter

    Thursday, May 16, 2013 8:14 PM


  • Hi Peter,

    One approach would be to add some JavaScript:

    function HideButton()
     var tags = document.getElementsByTagName('a');
     for (var i=0; i < tags.length; i++)
         if(tags[i].title == 'Attach File')
             tags[i].style.display = 'none'
    Another approach could be to use Jquery:
    And if you wanted to hide the Attach File button only to specific users, you could wrap your logic in an SPSecurityTrimmedControl:
    permissions="ManageWeb" runat="server">
    script here

    Keith Tuomi | Twitter: @itgroove_keith | Blog:

    Please click "Propose As Answer" if a post solves the problem or "Vote As Helpful" if a post has been useful to you.

    • Marked as answer by Peter Len Friday, May 17, 2013 2:07 PM
    Thursday, May 16, 2013 8:32 PM

All replies