How do I change the URL users are sent to after they fill out a New Item form?


This is a common request, particularly if your site has quite a few lists. Rather than bogging your users down with navigating into (and out of) each list, you may want to give your customers a quick and easy way to jump from your site’s landing page into your list forms and then back to your site’s landing page. The steps would look like this:

  1. Customer comes to your SharePoint site.
  2. Customer sees on your landing page a list of the form(s) that apply to them. They click on a link to go to the form they need.
  3. They fill out the form and click Save.
  4. They’re automatically returned to your SharePoint site’s landing page.

The first 3 steps are fairly straightforward, but step #4 is interesting. Normally, you are automatically taken to your list’s default view when you fill out and save a new item request. We want to change this default behavior. We don’t want our users to be taken to our list’s default view, because they don’t need to see all our list data. We want them to find their form, fill it out and then return to where they started. Fortunately, there’s a quick way to alter your user’s default path. By creating a custom link to your form and modifying the link’s HTML code, you can force SharePoint to take your end-users back to their starting point once they’ve finished filling out their form.

There are a variety of ways to modify your hyperlinks, including making customizations via SharePoint Designer. This blog post focuses on building these custom hyperlinks with out-of-the-box SharePoint web parts. Since the process differs slightly for MOSS 2007 and SharePoint 2010, I’ve included setup instructions for both platforms.

MOSS 2007 setup

First, you need to obtain the hyperlink for your list’s New Item form. Here are the steps for capturing this URL:

  1. Go to your site’s landing page.
  2. Click on Site Actions > Edit Page.
  3. Click on one of the Add a Web Part buttons.
  4. Select your list and click on the Add button. A web part for your list will be added to your site’s landing page. (Don’t worry–we’ll delete this web part in just a minute.)
  5. Right-click on the Add new item link that displays in the bottom left-hand corner of your list view web part. When the pop-up menu appears, select Copy Shortcut.
  6. Now you’re ready to delete this list view web part. Click on your web part’s edit link and select Delete.

Now that you have your New Item form’s URL, you’re ready to customize the URL and add it to your site’s default.aspx web part page. (Note that the steps outlined below can be used to add custom hyperlinks to any SharePoint web part page. You are not limited to adding these links to your site’s landing page.)

  1. Go to your site’s landing page.
  2. Click on Site Actions > Edit Page.
  3. Click on one of the Add a Web Part buttons.
  4. Scroll down the list of web parts until you find the Content Editor Web Part. Select this web part and click on the Add button to add it to your page.
  5. When the web part gets added to your page, it will appear with an open the tool pane hyperlink. Click on the hyperlink to configure this new web part.
  6. When the web part pane appears, click on the Source Editor… button.
  7. When the text entry box appears, key in the HTML code shown below. Replace the text highlighted in yellow with the URL for your new item form. Replace the text highlighted in blue with the verbiage you want displayed as your link. Leave the text highlighted in pink–this is the magic code that will make your hyperlink return users back to your site’s landing page after they submit their form.
  8. Click Save to save your changes.

That’s it! Your first HTML link is ready to go. Test it out and validate that it is working as desired.

You may want to pretty up your Content Editor Web Part a little bit (e.g. change the name of the web part and add additional form links), but otherwise you are ready for business. Here’s a picture of my finished page:

And here’s a picture of my final Source Editor code:

Note that I added some additional HTML tagging around my links–just enough to create a bulleted list for my form links. You can add in as much (or as little) HTML tagging as you want.

SharePoint 2010 setup

First, you need to obtain the hyperlink for your list’s New Item form. Here are the steps for capturing this URL:

  1. Go to the list you want to create a custom hyperlink for.
  2. Right-click on the Add new item hyperlink that appears at the bottom of the list view page. When the pop-up menu appears, select Copy Shortcut.
  3. Open a new browser window.
  4. Go to the address bar and do a Ctrl+V to paste in your newly copied URL.
  5. Press Enter. You will automatically be redirected to your list’s New Item page.
  6. Copy the updated URL that appears in your address bar–this is the URL you’ll be using to create your custom hyperlink.

Now that you have your New Item form’s URL, you’re ready to customize the URL and add it to your site’s Home.aspx web part page. (Note that the steps outlined below can be used to add custom hyperlinks to any SharePoint web part page. You are not limited to adding these links to your site’s landing page.)

  1. Go to your site’s landing page.
  2. Click on Site Actions > Edit Page.
  3. Click on the Insert subtab.
  4. Click on the More Web Parts icon.
  5. Click on Forms, select the HTML Form Web Part and click on the Add button.
  6. Once the new HTML Form Web Part is added to your page, click on the chevron for the web part and select Edit Web Part.
  7. When the web part pane appears, click on the Source Editor… button.
  8. Delete the text that appears in the text entry box.
  9. Key in the HTML code shown below. Replace the text highlighted in yellow with the URL for your new item form. Replace the text highlighted in purple with the verbiage you want displayed as your link. Leave the text highlighted in pink–this is the magic code that will make your hyperlink return users back to your site’s landing page after they submit their form.
  10. Click Save to save your changes.

That’s it! Your first HTML link is ready to go. Test it out and validate that it is working as desired.

You may want to pretty up your HTML Form Web Part a little bit (e.g. change the name of the web part and add additional form links), but otherwise you are ready for business. Here’s a picture of my finished page:

And here’s a picture of my final Source Editor code:

Note that I added some additional HTML tagging around my links–just enough to create a bulleted list for my form links. You can add in as much (or as little) HTML tagging as you want.

About these ads

18 thoughts on “How do I change the URL users are sent to after they fill out a New Item form?

  1. Thanks for the post, it was easy to follow. However, I get an HTTP 400 error when I submit a new item with the form. It doesn’t redirect me back to the original page. Any suggestions?

  2. Hello are using WordPress for your site platform?

    I’m new to the blog world but I’m trying to get started and set up
    my own. Do you require any coding knowledge to
    make your own blog? Any help would be really appreciated!

  3. I am trying to do this with a workflow initiation form. I want the user to be directed back to a webpart page instead of to the default list. How could I accomplish this?

  4. on the Source editor window, I type in the suggest html code and click save. I’m presented with a tiny window that says “Cannot Save your Changes”

    any ideas on this one?

    • Using a picture as your clickable link is fairly easy. When you add in your HTML code in the Source Editor, just call an image instead of keying in text to display for your link. You’ll need to use the IMG SRC HTML code for calling an image.

  5. Dear Sarah
    I am new to this and your explanation is fantastic. I also want to add to an image, but I dont know how to access the IMG SRC HTML code, please can you advise

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