1,804 articles and 14,608 comments as of Saturday, February 19th, 2011

EndUserSharePoint has combined resources with NothingButSharePoint.com. You can now find End User (Mark Miller), Developer (Jeremy Thake) and IT Pro SharePoint (Joel Oleson) content all in one place!

This site is a historical archive and is no longer being updated. Please update your favorites, bookmarks and RSS feeds.

NothingButSharePoint.com
Thursday, July 23, 2009

URL Source= for Thank You on Submit

Jeff JonesGuest Author: Jeff Jones, SharePoint on a String

Jeff Jones is a SharePoint developer and administrator in Chicago, IL.   He enjoys whiteboarding, peer coding, and being creative with software.  He has over 6 years of SharePoint experience and holds MCSE and MCTS certifications.

From Jeff Jones: Many times I’ve been asked to adjust the NewForm.aspx (add record) experience for users to display a custom message after submit.    A “Thank You” page for a survey is a great example.    Other times in request forms people want to show a confirmation or instructions page.

Thankfully the SharePoint product team made this easy for us developers.

Action Steps

  1. Visit the list or library you’d like to tweak
  2. Click on New item to get to /NewForm.aspx
  3. Take a close look at the URL and notice the word “Source=”
  4. We’ll come back to this in a minute
  5. To create a “ThankYou.aspx” page I like to duplicate the “DispForm.aspx” by going into SharePoint Designer
    1. Right click Copy on DispForm.aspx
    2. Right click and Paste
    3. Edit the file to remove the main web part
    4. Rename the file to “ThankYou.aspx”
  6. Edit the part after the equals sign (=) from #3 and replace with a URL you’d like to take people to after submit

Often the destination page for #5 above doesn’t yet exist.   So you’ll want to open SharePoint Designer 2007 and create a new ASPX page to hold a “Thank You” message.    For this I always place the ASPX file in the same /Forms/ folder as the list I’m working on.   

Why?    By placing a custom ASPX in the same /Forms/ folder it will be including in any List template (.STP) creation and is easier for future admin and dev staff to locate for troubleshooting.

 

Source for Thank You

Source for Thank You

Source for Thank You

Source for Thank You

Source for Thank You

Source for Thank You

Source for Thank You

Source for Thank You

Source for Thank You

Source for Thank You

Source for Thank You

Source for Thank You

 

Please Join the Discussion

12 Responses to “URL Source= for Thank You on Submit”
  1. Vamshi says:

    Hi Jeff,

    Interesting article.. but how to we get to change the destination URL? so that everyone can get to the same destination URL. I mean.. if you respond to the survey..it still points to Overview.aspx instead Thankyou.aspx… do you think we can solve it using SPD?

    Thanks
    Vamshi

  2. Caleb says:

    If you are creating a custom new list form in SPD (Insert > SharePoint controls > Custom List Form), you can right-click on the OK button and choose Properties and change the RedirectURL value in the Tag Properties pane.

    Or, if you don’t want to use the default buttons, you can insert a form action button from the Toolbox. A form actions box will automatically pop-up with an option for “Navigate to page”.

  3. Jeff Jones says:

    Hi Vamshi,

    Very good question. I’m a big JavaScript fan and a little biased that way when I think about solutions.

    How about adding JavaScript on the NewForm.aspx page to “fix” the URL if pointed at Overview.aspx?

    Modifying the system button for “Respond to this Survey” I’m not sure how to do and doubt is supported.

    The quick way would be like:

    if (document.location.href.indexOf(”overview.aspx”)>0) {
    document.location.href=”";
    }

  4. Vamshi says:

    Hi Caleb and Jeff,

    Thanks for the response

    Both of the options are great. The disadvantage we have by creating custom list forms is we loose the ability to attach files and Form Action works really well to navigate to a different page.

    Both Javascript and Form actions buttions are really cool. But now I am thinking.. how to we utilise this URL “Source=” functionality??? any ideas..?

    Thanks

  5. Caleb says:

    Vamshi,
    You’re right, you do lose the ability to attach files, which is a bug that MS apparently has no plans to fix. Definitely something to consider.
    If there’s any consolation, the file attachment is still available in the editform.

  6. Chuck Whittemore says:

    I followed the steps dutifuly, only to discover that the solution breaks when branching is used within the survey. Has anyone else encountered this and found a path to resolution?

  7. Does this require MOSS or can it also be done in WSS? I am having difficulty with the redirect URL.

  8. Jeff Jones says:

    Hi Brad,

    Yes, this can be done directly with WSS. It also works on any list template. Calendar, Task, Documents, etc.

    Best,
    Jeff

  9. Mark says:

    I know this blog is a bit old now, but is it possible to set this so that the default for all users is to go the Thanks.aspx page.

    From your instructions above, it looks like it’s a one time only redirect.

    My survey has branching enabled, and is open to all authenticated users. I want them to be directed to the thank you page when they’ve completed, rather than the summary or overview page.

    Thanks

  10. Jeff Jones says:

    Hi Mark,

    The redirect is part of the original request URL. So it all depends on how people get into the “NewForm.aspx” page. Typically I see HTTP links manually entered into an email where it easy to add the “?Source=ThankYou.aspx” suffix.

    JavaScript could help by adding the “?Source” URL parametric if missing. Adding a Content Editor Web Part to host JS code on the ASPX page guarantees no matter how people visit the page it can add the URL paramter (if missing).

    Check out insertParam() at http://stackoverflow.com/questions/486896/adding-a-parameter-to-the-url-with-javascript

    Best,
    @spjeff

  11. Hi Jeff!

    Thanks for your knowledge, i have a question though.

    There are 2 options if im correct:
    the ?source (redirect) and the ?IsDlg (show in full screen) option.

    If i use them seperately, everything works fine. But if i use them in combination only one works.

    Do you have any experience with this ?

    Thanks a bunch!

    Roland de Goeij.

  12. @SPJeff says:

    Hi Roland,

    I have not worked with that URL parameter before, but will take a look. Thanks for the heads up. I wrote this article for SharePoint 2007 and “IsDlg” appears to be something new for 2010.

    I would try to keep it as simple as possible and probably just use the ?Source= by itself.


Notify me of comments to this article:


Speak and you will be heard.

We check comments hourly.
If you want a pic to show with your comment, go get a gravatar!