1

I want to add a custom webpart on a custom list form and remove the Save and Cancel buttons which are default. Is what i'm trying to do possible? If yes please tell me a good approach to do it?

Thanks.........

0

4 Answers 4

4

One way at least is to use this CSS:

.ms-formtoolbar {
  display: none;
}
5
  • This is for 2013, and ListFormWebPart (I'm guessing you might be using both 2013 and this Web Part)
    – eirikb
    Apr 14, 2014 at 10:30
  • i want to access something like the codebehind of the default save and cancel buttons? Is it possible? Apr 14, 2014 at 10:47
  • If you have a completely custom form, then you should be able to edit the XSLT and just remove the buttons from there
    – eirikb
    Apr 14, 2014 at 10:47
  • say if i hide the default save button by the code which you have mentioned and add a visual webpart on that form which has a save button by itself then will any event receiver related to the list run when i click on my custom save button? Apr 14, 2014 at 10:52
  • That does sound like a horrible solution, but yes in theory that should work. Any button of type submit on the page should trigger a postback which should work as expected.
    – eirikb
    Apr 14, 2014 at 10:53
0

no, this code hide all bottons...

this is what you need i think

<script type=”text/javascript”>
var x=document.getElementsByTagName(“input”);
for (var i=0;i<x.length;i++)
 {
 if (x.item(i).type==”button”&&x.item(i).value==”Save and Close”)
 {x.item(i).style.display = “none”};
 }
</script>

<div style="padding-left:5px">
</ContentTemplate>

in newform.aspx and editform.aspx

0

you can edit the page by appending "&toolpaneview=2" , this will open the page in edit mode. Now hide the default webpart and add your custom webpart.

0

Create New and Edit forms in SharePOint Designer and change the ms-toolbar to ms-hidden.

This works for all fields

    <tr>
        <td class="ms-hidden" nowrap="nowrap">
            <table>
                <tr>
                    <td width="99%" class="ms-toolbar" nowrap="nowrap"><IMG SRC="/_layouts/15/images/blank.gif" width="1" height="18"/></td>
                    <td class="ms-toolbar" nowrap="nowrap">
                        <SharePoint:SaveButton runat="server" ControlMode="Edit" id="savebutton1"/>
                    </td>
                    <td class="ms-separator">&#160;</td>
                    <td class="ms-toolbar" nowrap="nowrap" align="right">
                        <SharePoint:GoBackButton runat="server" ControlMode="Edit" id="gobackbutton1"/>
                    </td>
                </tr>
            </table>
        </td>
    </tr>

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.