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