SharePoint – Forms, Create Save & Continue buttons

Sometimes you want to make life a bit easier, for the end user.

When entering data in a list saving the result and next :

Continue Editing using the edit form or jump the Display Form immediately showing the result.

Solution :

1. Create 2 extra button the NewForm.aspx

<tr>
<td class="ms-toolbar" nowrap="nowrap"><input type="button" value="Save and Continue Editing" style="font-size:8" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent(concat('__commit;__redirect={',$RedirectEdit,'}'))}" /></td>
<td class="ms-separator"> </td>
<td class="ms-toolbar" nowrap="nowrap"><input type="button" value="Save then Display"  name="btnSave2" onclick="javascript: {ddwrt:GenFireServerEvent(concat('__commit;__redirect={',$RedirectDisp,'}'))}" /></td>
</tr>

image

2. Next create 2 XSL variables

Here is the variables definition. These will hold the redirect URL information.

<xsl:variable name="RedirectEdit">EditForm.aspx?ID=<xsl:value-of select="$ListItemId"/></xsl:variable>
<xsl:variable name="RedirectDisp">DisplayForm.aspx?ID=<xsl:value-of select="$ListItemId"/></xsl:variable>

Which get’s fired when pressing the button (see code button) :

{ddwrt:GenFireServerEvent(concat(‘__commit;__redirect={‘,$RedirectEdit,’}’))}

{ddwrt:GenFireServerEvent(concat(‘__commit;__redirect={‘,$RedirectDisp,’}’))}

3. Next you need to create 1 Parameter variable.

This parameters will hold the List Item ID, which we will grab from the URL Query String. And feed to the variables.

In the SP Designer go to the Parameters button in the Ribbon.

image

image

Now you are done !

This will save him / her a few clicks, everybody happy. Smile

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: