Blog

Share this blog : twitter

Jul 7

Written by: IOTAP ::-- SharePoint Team
Monday, July 07, 2008 7:49 PM 

This is a tip for redirecting users to a different page when save button on a custom list form is clicked.

Sharepoint includes a set of forms for each list and library we create. These forms get displayed when we try to add, edit or view an item from the list. Sharepoint Designer allows us to easily replace this default form with a custom form to suit our requirements.  This article from Microsoft explains creating custom list with Sharepoint designer.

Custom list forms though very useful have a small draw back. When save or cancel button is clicked, users will be redirected to the all items page of the corresponding list. This may not be the desired course of action especially if the Sharepoint site is a public facing web site. There is no direct way of redirecting to another page after the list item is saved. After searching the web I came across a work around using java script and ddwrt GenFireServerEvent which is explained below.

The default save button generated by Sharepoint Designer for a custom form is of type SharePoint:SaveButton. We will have to replace this button with a standard html input button and hook up the onClick event to call the GenFireServerEvent method with the below syntax

onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={Redirect URL}')}"

Where Redirect URL is the URL where you want the page to be redirected after saving the item. For example the onclick event might look something like this

onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={ThankYou.aspx}')}"

Cheers JJ

Tags:

6 comment(s) so far...

Re: Redirecting to a custom URL from Sharepoint custom forms

This is a cool article... Thanks!

By Nilanka Perera on   Wednesday, October 14, 2009 8:57 PM

Re: Redirecting to a custom URL from Sharepoint custom forms

If you need to add the ID then try somehting like this, where FID is a parameter I'm using for moving from a custom DispForm to a EditForm and back again;

" {ddwrt:GenFireServerEvent(concat('__commit;__redirect={DispForm.aspx?FID=', $FID ,'}; '))}"

By Neal on   Wednesday, November 11, 2009 11:30 PM

Re: Redirecting to a custom URL from Sharepoint custom forms

Thank you, thank you, thank you! I have been banging my head on dead ends for a few hours and you saved me. Thank you!

By Monique on   Wednesday, November 25, 2009 12:55 AM

Re: Redirecting to a custom URL from Sharepoint custom forms

If you need to add the ID then try somehting like this, where FID is a parameter I'm using for moving from a custom DispForm to a EditForm and back again;

By Shared Web Hosting on   Monday, December 21, 2009 3:00 AM

Re: Redirecting to a custom URL from Sharepoint custom forms

I have been banging my head on dead ends for a few hours and you saved me. Thank you!

By Love poetry on   Sunday, January 17, 2010 8:34 PM

Re: Redirecting to a custom URL from Sharepoint custom forms

Thanks Mann.. Worked great!!!

By Kris on   Friday, January 29, 2010 2:13 AM

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel 


 
 
 

IOTAP is an IT Consulting and Software Services Company with global delivery centers in Mumbai and Chennai, India. We are a Microsoft Gold Certified Partner and use products and technologies like Dynamics CRM, SharePoint, Silverlight, and the .Net platform to create solutions that help our customers connect, communicate and collaborate effectively