0

How can I add button to footer of EditForm next to Save and Cancel buttons?

I want my new button to Save Changes and then Redirect to NewForm. I haven't come across anything that useful, maybe someone who has done it, can help?

I'm meaning something like this:

enter image description here

Taurib
  • 315
  • 2
  • 4
  • 18
  • Not the answer, but the way you have to go: http://sharepoint.stackexchange.com/questions/172280/how-to-design-the-sharepoint-list-newform-aspx/172283#172283 and here: http://sharepoint.stackexchange.com/questions/166156/make-task-form-field-read-only-using-sharepoint-designer/166170#166170 – Patrick Feb 26 '16 at 14:28
  • I had a similar requirement. I ended up with removing the Save button from the bottom of the form completely and adding an additional save button in the ribbon. If that would be a solution to your problem, I can post the code. – Paul Strupeikis Feb 26 '16 at 14:28
  • Going to check those links out, I prefer to keep those buttons down below. – Taurib Feb 26 '16 at 14:44

2 Answers2

2

Add the URL of the next (current) form as the &Source=[url] parameter

The Source parameter in the URL is where the browser is redirected to after a Form is saved. Default behaviour is to return to the AllItems View.

Open an EditForm and investigate the URL

(the same construct can be used on a NewForm)

The URL has to be URL encoded (and it needs to be within the SharePoint domain)

https://xxx.sharepoint.com/sites/iCSR/Lists/Tasks/NewForm.aspx
?Source=
 https%3A%2F%2Fxxx.sharepoint.com%2Fsites%2FiCSR%2FLists%2FTasks%2FAllItems%2Easpx
&RootFolder=

So if you replace that Source with URL of your NewForm

https%3A%2F%2Fxxx.sharepoint.com%2Fsites%2FiCSR%2FLists%2FTasks%2FNewForm.aspx

You can add an item and then be returned to a Blank NewForm

You might also be interested in:

Limit only one entry per day per user in sharepoint list

Danny '365CSI' Engelman
  • 21,176
  • 7
  • 35
  • 79
1

I did it quickly. Follow the links I posted and create a new EditForm.aspx.

The essential part ist this:

        <tr>
        <td class="ms-toolbar" nowrap="nowrap">
            <table>
                <tr>
                    <td class="ms-descriptiontext" nowrap="nowrap">
                        <SharePoint:CreatedModifiedInfo ControlMode="Edit" runat="server"/>
                    </td>                       
                    <td>
                    <input type="button" class="contact-button" value="Save + Redirect" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={NewForm.aspx}')}" />
                    </td>
                    <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="savebutton2"/>
                    </td>
                    <td class="ms-separator"> </td>
                    <td class="ms-toolbar" nowrap="nowrap" align="right">
                        <SharePoint:GoBackButton runat="server" ControlMode="Edit" id="gobackbutton2"/>
                    </td>
                </tr>
            </table>
        </td>
    </tr>

Here the CustomEditForm.aspx

enter image description here

You can also place the button in between the columns. Just take the three lines:

<td>
  <input type="button" class="contact-button" value="Save + Redirect" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={CustomNewForm.aspx}')}" />
</td>

and place it somewhere in between. e.G. I placed it between the lines 125-129.

enter image description here

After that the CustomEditForm looks like that:

enter image description here

Patrick
  • 3,203
  • 3
  • 24
  • 42
  • Nice, going to test it out, hopefully it works! :) – Taurib Feb 26 '16 at 14:46
  • Any news here? Did it help? – Patrick Feb 29 '16 at 09:19
  • Yes, this method does indeed work, there are just other problems, since I need to custom layout and custom amount of fields. For that there is a script, that hides all fields and displays, what are needed. Currently with that it doesn't seem to have good easy integration. If ContentLink tells you anything. – Taurib Mar 01 '16 at 13:41
  • But is there a way, that I could just add this button to random place in content and it would do the same job? Currently, when I add this input directly to content, it doesn't do anything – Taurib Mar 02 '16 at 10:08
  • updated the answer. Hope this helps – Patrick Mar 02 '16 at 15:16
  • Well the problem begins with this custom form, somehow/why it breaks, when there are fields displayed on it. When I try to add this button to my in WebPart (reading in JS content file), then this button doesn't work there. – Taurib Mar 04 '16 at 14:25