SharePoint Customization Tip: Redirect to a custom page after completing a list form

Note: This tip is really only useful if you have created custom buttons which point to the “NewForm.aspx” page of your list (aka: the create a new item part of your form). Example: Maybe you created a sign-up list and to get creative, you added a fancy button to your page which points to http://yoursite/Lists/Signup/NewForm.aspx

Such was the case while working through some final tweaks on the Community Kit for SharePoint: User Group Edition 1.0 with Lawrence, he let me in on an interesting tip which I think others will also find quite useful so I wanted to share it here.

The tip is that you can easily redirect users to a custom page/url after they have completed the form by appending a ?source= URL to the end of the URL pointing to the list.
End to End Example:

  • Create a custom list, call it signup. Add a column or two to make it realistic.
  • Create a web part page, name it Thank You. Place it in a library of your choice.
  • Add a content editor web part to the page, modify it to display your thank you message.
  • When satisfied, exit edit mode and copy the the entire URL from the browsers address bar.
  • Create a sign-up button in your editor of choice and upload it to a library of your choice.
  • Add your image to the page, again using a content editor web part.
  • Link your button to the form using the following HREF: http://yoursite/Lists/Signup/NewForm.aspx
  • To redirect users to a custom page after they have completed the form, simply add ?SOURCE=Your Thank You Page.
  • In the end you should have an HREF around your image that resembles something along the lines of a a http://yoursite/yourlist/newform.aspx?source=http://yoursite/yourlibrary/thankyou.aspx

Hope it helps :)

524 comments on “SharePoint Customization Tip: Redirect to a custom page after completing a list form

  1. Swati says:

    hi
    I am facing this issue —
    how to redirect to a custom page from an event handler?
    as it is a class library project there is no response.redirect available.
    I have also tried Httpcontext.current , however that is null so cant use it

    Now i am working on simulating a mock httpcontext but have not been successful so far

    Looking forward to a reply

    Thanks
    Swati

  2. Chris Cundy says:

    Hi,

    I cant get this working. I have removed the standard link bar and added a custom Submit button.

    Using Javascript:ClickOnce(); as the URL.

    This defaults to posting the form information to AllItems.aspx

    When I tried your method for the URL redirect and put in google.com for example, the redirect didnt occur. The page just remained on the AllItems.aspx page.

    Best Regards

    Chris

  3. shane says:

    I implemented this in the Community Kit for SharePoint (User Group Edition) if you want to grab it and take a look. The sign-up form uses it.

    http://sharepoint.microsoft.com/sharepoint (Follow the CKS link in the top navigation bar).

    Shane

  4. Chris Cundy says:

    ok, but what is the code i would use on my submit button to send the information and then redirect the page to say google.com for example??? and maybe have a popup saying thank you your details have been sent etc.

    many thanks again

  5. Chris Cundy says:

    i would really appreciate some help with this

    getting the code to work:

    so click on custom submit button >>

    what code do I put into the hyperlink to send it to my allitems.aspx file, then say thank you for submitting data (in a window) and then redirecting the user to another site say google for example.

    many thanks again

    chris

  6. Brian Terry says:

    Using the same method as Chris Cundy (Javascript:ClickOnce(); as the URL).
    How do we use the redirect?

  7. Kris says:

    I, also, cannot get this to work on a MOSS 07 site. No matter what page I put as the source value, it always returns to the list page’s default view. I tried using a different view, a different page on same site, a different page on different site. No luck. I tried removing everything from the URL except for the source. Still didn’t work. I’ve tried the method on different lists. Nothing. Too bad – this would have saved me a ton of time…

  8. Chris says:

    So how would this work if you have more than one content type?

  9. Jeff says:

    Thank’s so much for this tip. The conversion to WSS 3.0 broke an application I built for a client and I have spent hours trying to fix the issue before I ran across this tip. Then a few seconds later it works like a charm.

    Thanks,

    Jeff

  10. Petr Berezkin says:

    It is possible to redirect to url with item id in query string ?

  11. Jeremy Thake says:

    Thanks for this…one question though, if they actually navigate to the List (e.g. anyone with SharePoint knowledge could guess the List url – e.g. it’s in the New Form bread crumb trail) and then view the List. Can you restrict viewing items? When I select anonymous entry of new items, it actually selects View Items also?

  12. Cristhian says:

    Hi, I want to solve this:

    I made a Custom Form List in a .aspx form in Sharepoint Designer, and I want to change the redirectURL property of the SaveButton (such as /Page/Thanks.aspx), but, everytime I change it, the Sharepoint Designer always change it back to the default url (/Lists/Visitantes/AllItems.aspx). I hate this, because it doesn’t let me finish this page.

    If you have a solution for this, please, let me know as soon as you can.

    Thanks.

  13. Michael says:

    I’d love to use this tip in a site I’m building. The trouble I’m having is that I want to turn the site into a template which means that I can’t hard-code the URL into the link. Is there a way to grab the URL of the page I’m currently on (where the edit link is) and enter that into the HREF?

    i.e. I want to have a process that looks like: StartPage -> EditPage -> StartPage

    So, (if I knew how to code) I would want to put something like this onto my edit link in StartPage:
    http://yoursite/yourlist/newform.aspx?source={URLofStartPage}

    thanks…

  14. Gustavo says:

    Michael
    try to configure the parameters with QueryString ex. fromPage

    and in the source put it there
    ex

    http://mysite.com/thanks_page?source={$fromPage}

  15. Dan says:

    Good tip! Only thing is that I would have liked it to allow me to set an alert on it for one user. However, for whatever reason you cannot set an alert if users can only read their own items.

    Error page excerpt: “You cannot create alerts for lists for which users can only read their own items. ” Maybe possible to restrict who can see allitems.aspx?

    Thanks
    Dan

  16. Dan says:

    It also only seems to work in IE. I’m getting 401 unauthorized errors in Firefox and Safari…

  17. Hi Shane,
    I ran across your blog and have a question if you have time…

    I’m a member of a small community services group comprised of
    several individuals across the US….We help foster kids.

    http://www.leaptoicsonline.com/

    Right now were using Google Apps as a collaboration place but need something a little more robust to share ideas etc..

    One of our members suggested a collaborative, customized Sharpoint site that would include:

    MS Live meeting
    Shared calendar
    Shopping cart
    Shared email
    SharePoint

    I’m probably the most technical of the group, but more talent on the design side than coding….so we wouldn’t be able to create our own.

    Do I look for a web host to do all this or an individual to set this up for us? What kind of a budget do you think were looking at?

    I really appreciate any kind of direction you can point me in.

    Thanks,
    Jeff Bradshaw

  18. Jim Raley says:

    Thanks, Shane, this really did work.
    This is really helpful trick too, and this is the only place I found it. If you use a “form action” button to submit (‘commit’) an item, it will break the page validation (the ‘required field’ stuff), which of course creates a much bigger problem, especially where HTML-enabled fields are concerned.

  19. sanjay says:

    Greetings!

    I need some urgent help. I am creating a website using wss 3.0. I want to redirect the visitor to a default page when he types a url in the browser. In the current secenario if the visitor types http://www.mydomain.com/content (where “content” is the document library) wss displays the entire document library. I would not like the visitor to see my document library. How do i resolve this.

    Thanks in advance

    Sanjay

  20. Melissa says:

    Thank you so much for this great tip! This is exactly what I was looking for….however, when I add the redirect link to the properties of the button, or add your code directly do the code on the page it still redirects to allitems.apsx. Which is actually not even coming up. So the user gets a page cannot be displayed error. Any help would be greatly appreciated.

    Thanks!
    Melissa

  21. Eric Bartels says:

    I found a way to achieve the same by using a custom event receiver. So there is no need to “hack” the Source-parameter.

    http://www.entwicklungsgedanken.de/2008/03/27/redirecting-from-newformaspx-to-dispformaspx-after-creating-a-new-item/

    Greetings
    Eric Bartels

  22. Mike says:

    Hi,

    This works great but I want to use it on the standard edit mode (for example when you change the properties of a document in Sharepoint). Is it possible to manupulate this standard link and replace is bij your suggestion?

    Thanks, Mike

  23. Merlin says:

    Hi

    How can I have diffrent redirect page for the OK button and the Cancel Button ?

    thx

    Merlin

  24. Deborah French says:

    The button on the contact list is already there, but I cant find where to change it at. I can place my own button but would then have two buttons on the page

  25. Deborah French says:

    this code is so much simpler and straightforward

    function PreSaveAction() {
    var srcUrl=GetSource();
    var newSrcUrl = “http://www.simplykansas.com/CU/Pages/default.aspx”;
    var i = aspnetForm.action.lastIndexOf(srcUrl);
    aspnetForm.action = aspnetForm.action.substring(0,i) + newSrcUrl ;
    return true;
    }

  26. koushik says:

    Thank you ! It works

  27. Gaurav says:

    i was using the data from the page and now the address of the page is changed now i am unable to access any data content please tell me how to redirect to a new address i am using sharepoint Designer-2007

  28. Andrew says:

    I have added the redirect page after ?source= in a link and when I submit, I get page not found error, even though the redirect page exists. I have had success on a few occassions, but not really able to see a pattern, it has worked, but more often than not it doesn’t. Maybe it could be related to whether a user is signed in or not?

  29. Andrew says:

    Found the solution to my problem. The file at my redirected address was not accessible by guest users ie users that had not signed in. So, when they submitted the form, the list was updated with their input, but the result for the redirect was a “page not found” error.

    Users that were signed in didn’t have this problem, all worked fine. Now I have anonymous access setup for the redirect page and everything works.

  30. Ven says:

    Hi,
    I am using Forms Authentication in my SPS site. After successful login, I want the users to be redirected to my own Page,rather than to the Default.aspx page. Please give me the detailed steps to achieve this.

  31. Elena says:

    Hi Shane!
    I have done these source substitutions successfully in the past, but I have a scenario now where I need to redirect the user to different pages based on whether he clicks “OK” or “Cancel” when entering a new item in a list.
    I want the link to redirect to a custom .aspx page when the user clicks OK, but it can go back to the source sharepoint site if the user clicks Cancel.
    Any ideas on how I can accomplish this?

  32. Piyush Kant says:

    For Save and Redirect on desire page use own custom button except than SharePoint Button for example i am going to replace OK button of Edit.aspx page.

    write java script function in any area
    Code

    function myjavascriptRedirect()
    {

    setTimeout(“doSomething()”,200);

    }
    function doSomething()
    {
    history.go(-2);
    }

  33. Pingback: learn more
  34. Pingback: airport car rental
  35. Pingback: best mortgages
  36. Pingback: here
  37. Pingback: here
  38. Pingback: here
  39. Pingback: here
  40. Pingback: here
  41. Pingback: here
  42. Pingback: here
  43. Pingback: here
  44. Pingback: here
  45. Pingback: here
  46. Pingback: here
  47. Pingback: here
  48. Pingback: here
  49. Pingback: here
  50. Pingback: here
  51. Pingback: here
  52. Pingback: here
  53. Pingback: here
  54. Pingback: here
  55. Pingback: here
  56. Pingback: here
  57. Pingback: here
  58. Pingback: here
  59. Pingback: here
  60. Pingback: here
  61. Pingback: here
  62. Pingback: here
  63. Pingback: here
  64. Pingback: here
  65. Pingback: here
  66. Pingback: here
  67. Pingback: here
  68. Pingback: here
  69. Pingback: here
  70. Pingback: here
  71. Pingback: here
  72. Pingback: here
  73. Pingback: here
  74. Pingback: here
  75. Pingback: ecm programming
  76. Pingback: here
  77. Pingback: here
  78. Pingback: here
  79. Pingback: here
  80. Pingback: here
  81. Pingback: here
  82. Pingback: here
  83. Pingback: here
  84. Pingback: here
  85. Pingback: here
  86. Pingback: here
  87. Pingback: here
  88. Pingback: here
  89. Pingback: here
  90. Pingback: here
  91. Pingback: here
  92. Pingback: here
  93. Pingback: here
  94. Pingback: here
  95. Pingback: nutrisi
  96. Pingback: here
  97. Pingback: here
  98. Pingback: here
  99. Pingback: apa itu nutrisi
  100. Pingback: kesehatan kerja
  101. Pingback: hollywood diet
  102. Pingback: herbalife diet
  103. Pingback: knee therapy
  104. Pingback: kitchen set elegan
  105. Pingback: here
  106. Pingback: here
  107. Pingback: here
  108. Pingback: here
  109. Pingback: here
  110. Pingback: here
  111. Pingback: here
  112. Pingback: here
  113. Pingback: here
  114. Pingback: here
  115. Pingback: here
  116. Pingback: here
  117. Pingback: here
  118. Pingback: here
  119. Pingback: here
  120. Pingback: here
  121. Pingback: here
  122. Pingback: here
  123. Pingback: here
  124. Pingback: here
  125. Pingback: here
  126. Pingback: here
  127. Pingback: here
  128. Pingback: here
  129. Pingback: here
  130. Pingback: here
  131. Pingback: here
  132. Pingback: here
  133. Pingback: here
  134. Pingback: here
  135. Pingback: here
  136. Pingback: here
  137. Pingback: here
  138. Pingback: here
  139. Pingback: here
  140. Pingback: here
  141. Pingback: here
  142. Pingback: here
  143. Pingback: here
  144. Pingback: here
  145. Pingback: here
  146. Pingback: here
  147. Pingback: here
  148. Pingback: here
  149. Pingback: here
  150. Pingback: here
  151. Pingback: here
  152. Pingback: here
  153. Pingback: here
  154. Pingback: here
  155. Pingback: here
  156. Pingback: here
  157. Pingback: here
  158. Pingback: here
  159. Pingback: here
  160. Pingback: here
  161. Pingback: here
  162. Pingback: here
  163. Pingback: here
  164. Pingback: here
  165. Pingback: here
  166. Pingback: top travel korea
  167. Pingback: here
  168. Pingback: here
  169. Pingback: here
  170. Pingback: here
  171. Pingback: here
  172. Pingback: cheap wow gold
  173. Pingback: here
  174. Pingback: here
  175. Pingback: here
  176. Pingback: here
  177. Pingback: here
  178. Pingback: here
  179. Pingback: here
  180. Pingback: here
  181. Pingback: here
  182. Pingback: cheap wow gold
  183. Pingback: here
  184. Pingback: here
  185. Pingback: here
  186. Pingback: here
  187. Pingback: here
  188. Pingback: here
  189. Pingback: here
  190. Pingback: here
  191. Pingback: here
  192. Pingback: gizi untuk balita
  193. Pingback: here
  194. Pingback: here
  195. Pingback: here
  196. Pingback: here
  197. Pingback: here
  198. Pingback: here
  199. Pingback: here
  200. Pingback: here
  201. Pingback: here
  202. Pingback: here
  203. Pingback: here
  204. Pingback: here
  205. Pingback: here
  206. Pingback: here
  207. Pingback: here
  208. Pingback: here
  209. Pingback: here
  210. Pingback: here
  211. Pingback: sitemap
  212. Pingback: here
  213. Pingback: here
  214. Pingback: here
  215. Pingback: here
  216. Pingback: Toms Sko norge
  217. Pingback: contoh karangan
  218. Pingback: pengertian siswa
  219. Pingback: observasi adalah
  220. Pingback: contoh wacana
  221. Pingback: pengertian budaya
  222. Pingback: contoh qiyas
  223. Pingback: contoh karangan
  224. Pingback: replca Explorer
  225. Pingback: toms shoes outlet
  226. Pingback: toms shoes outlet
  227. Pingback: billig toms Sko
  228. Pingback: toms sko
  229. Pingback: Crazy Bulk Reviews
  230. Pingback: Brestrogen
  231. Pingback: Breastactives
  232. Pingback: Brestrogen Reviews
  233. Pingback: Holiday Deals
  234. Pingback: Crazy Mass Reviews
  235. Pingback: PhenQ
  236. Pingback: Phen375
  237. Pingback: Phen375 Reviews
  238. Pingback: Ehealth Harmony
  239. Pingback: Fitness N Glamour
  240. Pingback: Crazy Bulk Anavar
  241. Pingback: Crazy Bulk TBAL75
  242. Pingback: Crazy Bulk HGH-X2
  243. Pingback: Crazy Bulk NO2-Max
  244. Pingback: Anadrol
  245. Pingback: Anavar
  246. Pingback: Clenbuterol
  247. Pingback: Dbal Max
  248. Pingback: Dianabol
  249. Pingback: Deca Durabolin
  250. Pingback: Boost Breast Milk
  251. Pingback: Beauty Skin Talks
  252. Pingback: Crazy Mass
  253. Pingback: Anadrolone
  254. Pingback: Hgh Elite Series
  255. Pingback: Crazy Bulk
  256. Pingback: Phen375
  257. Pingback: PhenQ
  258. Pingback: SizeGenetics
  259. Pingback: Muscletronic
  260. Pingback: V Tight Gel
  261. Pingback: Crazy Bulk Reviews
  262. Pingback: Zeta Clear
  263. Pingback: SnoreMeds
  264. Pingback: Skinade
  265. Pingback: Hiprolean XS
  266. Pingback: PEYRONIES DEVICE
  267. Pingback: Phen375 Review
  268. Pingback: Provillus
  269. Pingback: FORSKOLIN 250
  270. Pingback: Forskolin Fuel
  271. Pingback: Phenq Weight Loss
  272. Pingback: Penomet
  273. Pingback: Provillus
  274. Pingback: Weight Loss Pills
  275. Pingback: Phenq Diet Pills
  276. Pingback: V Tight Gel
  277. Pingback: PhenQ
  278. Pingback: Phen375
  279. Pingback: Boost Breast Milk
  280. Pingback: Crazy Mass
  281. Pingback: Vigrx Plus
  282. Pingback: Garcinia Pure
  283. Pingback: Phenq Coupon Code
  284. Pingback: Crazy Bulk
  285. Pingback: Buy PhenQ Here
  286. Pingback: Phen375
  287. Pingback: Buy Crazy Mass
  288. Pingback: Muscle Building
  289. Pingback: Noocube
  290. Pingback: La France Law
  291. Pingback: Crazy Bulk Coupons
  292. Pingback: DigestIt
  293. Pingback: Garcinia Cambogia
  294. Pingback: Gynexin
  295. Pingback: Idol Lash
  296. Pingback: GCB Max
  297. Pingback: EvoTea TeaTox
  298. Pingback: Phenq
  299. Pingback: Crazy Bulk Anvarol
  300. Pingback: Vigrx Plus
  301. Pingback: Phen375
  302. Pingback: SizeGenetics
  303. Pingback: Crazy Bulk Reviews
  304. Pingback: DecaDuro
  305. Pingback: Growth Factor Plus
  306. Pingback: Crazy Bulk Tbal75
  307. Pingback: Breast Actives Buy
  308. Pingback: Yacon Molasses
  309. Pingback: E-Cig Vapor Kits
  310. Pingback: Legal Steroids
  311. Pingback: Crazybulk Dbal
  312. Pingback: Penomet
  313. Pingback: Zotrim
  314. Pingback: Phenq
  315. Pingback: PhenQ Avis
  316. Pingback: rialudi
  317. Pingback: kroaqkgirc
  318. Pingback: NBA2K16
  319. Pingback: NBA

Leave a Reply