Site icon @WonderLaura

May the &Source Be With You

This week during our SharePoint Shoptalk weekly conference call, one of the callers asked about modifying a SharePoint list form’s submit button.  Basically, when you fill out a SharePoint list form, by default after the form is filled out, you are taken to the default list view of that list.  There are a lot of cases where we want to give people access to add content to the list, but don’t necessarily want them to see the list.

You would think that you’d have to modify the “OK” button in order to change the page that you go to after you fill out a form, but that’s not necessarily the case.  It’s possible to customize it by creating a custom form, but you may not need to.

When you click the “NEW” button on any list, take a look at the URL.  It contains a section that looks something like this:

&Source=http%3A%2F%2Fintranet%2Econtoso%2Ecom%2FLists%2FContacts%2FAllItems%2Easpx

This “Source” tells the form where to take you after you’ve either filled it out or clicked cancel.  In this case, it takes you to here:

http://intranet.contoso.com/Lists/Contacts/AllItems.aspx

What are all of the those characters, and how can it be translated?  Here’s one URL encoder/decoder page that you can use.  Also, make sure that every “.” becomes a “%2E”.

So, how do you make this work as a part of your solution?  The default “New” button will still take you to that same list view, so you actually have to create a custom link somewhere for the users to click, as opposed to the default one.  For example, you can put a Content Editor Web Part on the front page of your site, with some text that says “Fill Out a New Form”, with a custom hyperlink that you’ve created that will open your form’s NewForm.aspx page, with your custom &Source in the URL.

This method works GREAT with InfoPath…

… because you can’t do anything inside of the form to make it navigate anywhere in particular after the form is filled out.  So, you’d use the same method, and click the NEW button like you’re filling out a new browser-based form.  Grab that URL, and simply modify the &Source part to create your own custom “Fill out this form” hyperlink.

You may have noticed that in SharePoint 2010, the forms pop up in a separate window.  I haven’t figured out how to configure a URL from scratch to make it do that… maybe someone will chime in… BUT I do know that you can go into the advanced settings of your list, and there’s an option called Launch forms in a dialog, that you can configure.  In SharePoint 2010, you CAN still point to the newform.aspx page, but it just won’t pop up, it will go to that whole page.

 


Exit mobile version