none
How to redirect after completing list form

    Question

  • Hi - I'm having trouble redirecting to a sharepoint page. When i completed editing or adding a new item to a list i want to redirect to another page in my sharepoint site.

    I search the web and tried some tips but it wont work,.

    i tried this below, but the validation is not working, so its not what i want

    <input type="button" value="Submit" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={http://www.yoursite.com/customPage.aspx}')}" />

    thanks,


    ®©™½¼

    Thursday, March 08, 2012 11:02 AM

All replies

  • There are multiple ways of doing this:

    1. You can  modify the Source attribute in the querystring using javascript to your required URL.

    2. You can use an event receiver to redirect to the required page


    Regards, Huzefa Mala, MCTS

    Thursday, March 08, 2012 11:20 AM
  • Thanks Huzefa, i will choose your option 1, but how, can you show me some steps to achive this?

    when i click New

    here is the url that show in the browser

    http://mysitecollection/Sandbox/Lists/MyList/CustomNewForm.aspx?List={17B97F5A-55D5-4574-8B13-CE0213288133}


    ®©™½¼


    • Edited by jwill92 Thursday, March 08, 2012 11:27 AM
    Thursday, March 08, 2012 11:25 AM
  • You need to perform the following steps:

    1. Go to your page (new form or edit form) change the URL to contain the following querystring parameter toolpaneview=2 e.g. if your url is http://mysite/lists/listname/newform.aspx?listid=<GUID> then change it to http://praveenbattula.blogspot.in/2009/04/replace-querystrng-with-some-value-in.html. If it doesn't already exist then add the source parameter to the url as window.location.href = yoururl + "&Source=<relativeurl>";
    2. Save the page and perform your required action

    Regards, Huzefa Mala, MCTS

    Thursday, March 08, 2012 2:57 PM
  • Thanks,

    When i add toolpaneview=2 it will edit the page

    then if i will add the window.location.href = yoururl + "&Source=<relativeurl>" in a CEWP it will just redirect it to the page in the source, but i can no longer add an item,

    i think it will not work

    i need to add an item then redirect to a custom page.


    ®©™½¼

    Friday, March 09, 2012 6:48 AM
  • I was not getting any error in my environment.

    Can you please tell me what error are you getting?


    Regards, Huzefa Mala, MCTS

    Friday, March 09, 2012 10:09 AM
  • can you give me sample code snippet?

    i add cewp in my customnewform.aspx

    it will loop only if i will add window.location.href =


    ®©™½¼

    Friday, March 09, 2012 10:28 AM
  • You are right.. Sorry but this solution won't work..

    Is the event receiver feasible for you.


    Regards, Huzefa Mala, MCTS

    Friday, March 09, 2012 6:12 PM