Add a redirect to SharePoint new item form with datasource in site pages

I have created a new SP2010 aspx page for users to create a new request. When they have filled in the form they should be a redirect to a “thank you” page.
I did this via SPD2010, creating a new page with a datasource to the “new” functionality of the request list.

So I got into following troubles:
– Page was created in Site Pages
– When a request is filled in, the page reloads
– When you add a ?Source, it doesn’t get picked up

So, there is a generic FireServerEvent that handles the action on the buttons where you can do something with. I couldn’t get a window.location through though.

Then a coworker came with a solution: ‘__redirect=(yoursite)’
So the code on the button looks like:

<input type="button" value="Save" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={}')}" />

There is also a way to do this in SharePoint Designer. When you click on the button, right click and choose form actions. There you can add actions to the button.
More info here

About: Marijn

Marijn Somers (MVP) has over 14 years experience in the SharePoint world, starting out with SP2007. Over the years the focus has grown to Office 365, with a focus on collaboration and document management. He is a business consultant at Balestra and Principal Content Provider for "Mijn 365 Coach" that offers dutch employee video training. His main work tracks are around user adoption, training and coaching and governance. He is also not afraid to dig deeper in the technicalities with PowerShell, adaptive cards or custom formatting in lists and libraries. You can listen to him on the biweekly "Office 365 Distilled" podcast.

3 thoughts on “Add a redirect to SharePoint new item form with datasource in site pages”

  1. This is a really good read for me. Must admit that you are one of the best bloggers I ever saw. Thanks for posting this useful article.

Leave a Reply