Monday, August 16, 2010

Redirect AddForm.aspx,EditForm.aspx Page to custom page.

Bydefault SharePoint List AddForm.aspx and EditForm.aspx page redirect you to AllItem.aspx page when you click on "OK" or "Cancel" button.

If you want to redirect your AddForm.aspx and EditForm.aspx page to your custom page, here is the solution.

1) Open your AddForm.aspx page in SharePoint Designer.
2) Right click on SharePoint ListForm Webpart, go to webpart properties and hide webpart.
3) Add Custom List Form from Insert->SharePoint Control.
4)Select your list name and select your form (e.g New Item Form).
5)Comment save button().
6)Insert javascript with button like (<button id="savebutton1" name="Ok" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={/Subsite/Pages/test.aspx}')}" style="width: 16px;" title="Ok" value="Ok"></button>)
 Or

<input name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent('__redirect={/subsite/Pages/test.aspx}')}" type="button" />
7)Save the page and check page is now redirect to your sprecified link.

3 comments:

  1. Thank you very much... I was looking for this solution for the last one day. You saved my time :)

    ReplyDelete
  2. GenFireServerEvent is undefined

    ReplyDelete
  3. Could you please help me out how to write for delete item

    ReplyDelete