Friday, January 22, 2010

List Insert View | Change Redirect URL

After you insert items in lists, the page goes to AllItems.aspx.
This can be undesireable if you want to allow annonymous access to the form.

Microsoft's documentation says to add RedirectUrl="yourUrl" to the submit button

Others, as me, tried and only worked by replacing the sharepoint button by an html input button with javascript code.

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


http://social.msdn.microsoft.com/forums/en-US/sharepointdevelopment/thread/7aff3de2-4250-47ac-9175-2fdc0a685005

2 comments:

  1. this doesnt't work for me either. Altough it redirects to Thankyou, it does not submit to the list

    ReplyDelete
  2. sorry to hear that. one of the things I remember is I was working with MOSS 2007 at the time (not SP2010); I did not remove the sharepoint button, just hidden it; and all my fields have to be in the same page (cannot have multipage insert forms using custom lists... unless you use panels to simulate it)

    ReplyDelete