locked
Sharepoint redirect Newform.aspx to Editform.aspx after the item has been added RRS feed

  • Question

  • Hi All,

    I have created a custom field type which upload images to picture library and save the image name as a value in this field. I disallowed users to upload images in the newform.aspx, because I need the item ID when I save the images. So they can only upload images in editform.aspx of the list.

    My problem is I need to redirect the user from the newform to the editform after he save the item in a list use this field.

    Note: I didn't make any customization on these forms, Just add new column of my field

     

    Could anyone help me please?

    Wednesday, May 11, 2011 10:43 AM

Answers

  • This is the codeI have used before in my custom form pages. Replace the input for the save - the only difference between out of the box and this - (if memory serves me correctly) is the __redirect=.....

    You will need to make a custom form to make this change.

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

    Hope this helps.


    Heather Waterman SharePoint Desginer www.heatherwaterman.com
    • Marked as answer by Leoyi Sun Friday, May 20, 2011 9:39 AM
    Wednesday, May 11, 2011 11:51 AM
  • Use the "Source" parameter/query string in the URL. Whatever url is specified in the "Source", the form will automatically redirect the user there. Something like this:

    http://site/list1/newform.aspx?Source=<link to the edit form goes here>

     


    Pman
    http://www.pmansLab.com/
    • Marked as answer by Leoyi Sun Friday, May 20, 2011 9:38 AM
    Wednesday, May 11, 2011 11:54 AM
  • Hey Mohamed,

    The problem you are going to encounter is that you need the ID for the item you just created in order to redirect the user to the Edit Form displaying the correct item using the correct method that Ms. Waterman suggested... 

    The cleanest way I have found to do this without opening up Visual Studio is to use SPServies (http://spservices.codeplex.com) to overwrite the save button with my own method for saving the item.  I then retrieve the ID from the item I just created and redirect the user to the edit page passing the correct Query String variable for the ID.

    The following forum post is almost identical to your request and should prove useful to you as well. Look at the response marked as the answer, you would use the same method for your needs:

    http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/c0323fc8-e48e-430d-8a19-d75b24f18a1e

    Good luck!

    Mark

    • Marked as answer by Leoyi Sun Friday, May 20, 2011 9:38 AM
    Wednesday, May 11, 2011 1:48 PM

All replies

  • This is the codeI have used before in my custom form pages. Replace the input for the save - the only difference between out of the box and this - (if memory serves me correctly) is the __redirect=.....

    You will need to make a custom form to make this change.

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

    Hope this helps.


    Heather Waterman SharePoint Desginer www.heatherwaterman.com
    • Marked as answer by Leoyi Sun Friday, May 20, 2011 9:39 AM
    Wednesday, May 11, 2011 11:51 AM
  • Use the "Source" parameter/query string in the URL. Whatever url is specified in the "Source", the form will automatically redirect the user there. Something like this:

    http://site/list1/newform.aspx?Source=<link to the edit form goes here>

     


    Pman
    http://www.pmansLab.com/
    • Marked as answer by Leoyi Sun Friday, May 20, 2011 9:38 AM
    Wednesday, May 11, 2011 11:54 AM
  • Hey Mohamed,

    The problem you are going to encounter is that you need the ID for the item you just created in order to redirect the user to the Edit Form displaying the correct item using the correct method that Ms. Waterman suggested... 

    The cleanest way I have found to do this without opening up Visual Studio is to use SPServies (http://spservices.codeplex.com) to overwrite the save button with my own method for saving the item.  I then retrieve the ID from the item I just created and redirect the user to the edit page passing the correct Query String variable for the ID.

    The following forum post is almost identical to your request and should prove useful to you as well. Look at the response marked as the answer, you would use the same method for your needs:

    http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/c0323fc8-e48e-430d-8a19-d75b24f18a1e

    Good luck!

    Mark

    • Marked as answer by Leoyi Sun Friday, May 20, 2011 9:38 AM
    Wednesday, May 11, 2011 1:48 PM
  • I figured out how to direct the user from the NewForm.aspx to the Custom EditForm.aspx, but how do I go back to the NewForm.aspx after the user clicks Cancel or Save. You must have the ID=',@ID,'

    <input name="Submit1" type="submit" value=" revise  " onclick="javascript: {ddwrt:GenFireServerEvent(concat('__redirect={https://RootSiteName.com/SubSite/helpdesk/LRTSurveyTool/Lists/Answers/EditForm.aspx?ID=',@ID,'&amp;Source=https://RootSiteName.com/SubSite/helpdesk/LRTSurveyTool/ShowQuestion.aspx?Title=',$URL1,'&amp;Question=',@QuestionNumber,'&amp;Of=',$URL2,'&amp;Session=',$URL3,'}'))}" />


    Michael L. Williams


    Friday, October 26, 2012 3:36 PM