2

[Sharepoint Server 2010 Scenario]

I would like to redirect the user to a specific page according to the button clicked on the sharepoint default form when submitting new item to a list.

At the moment the users access the "add new item" form using a link on the web page. I'm redirecting the user to page A setting the "Source" in the link as follows:

http://goasp002/sites/IT/Lists/Service%20Requests/NewForm.aspx?Source=http%3A%2F%2Fgoasp002%2Fsites%2FIT%2FSitePages%2FIT%20Self%20Service%20Page%20-%20Request%20Fulfilment%20-%20Confirmation%2Easpx

But this is limiting, as the user will be redirected to Source both in "Save" and "Cancel" event.

Please suggest or describe the technique used to redirect user to page A upon "Save" and page B upon "Cancel". I would like a "Power User" solution if any, or, eventually, I can customize the NewForm.aspx in the Sharepoint Designer if necessary.

Thanks

1

4 Answers 4

2

You would need to write your own JavaScript PreSaveAction() function and include it in the form that would run the logic and pass the applicable source property so the form redirects where you want.

Note that writing your own PreSaveAction() will override SharePoint's checks of required fields in the UI, so if you have required fields you'll need to include that logic in your function. This was the case in 2007, I haven't tried this in 2010 but I would expect it to be the same.

SharePoint should validate the data when it saves the data, but at that point the user would have to re-input the information if a validation issue was found.

There's a pretty decent overview of PreSaveActions() here: http://ghamson.wordpress.com/2011/01/25/useful-javascript-function-presaveaction-sp2010-sharepoint-ps2010-projectserver-in/

1

If you are comfortable with SharePoint Designer you could create a DataForm and change the behavior of the Save and Cancel buttons. In the code you can add a __redirect option after the commit option. I use this to send users to other pages and it works well. Another option is to use javascript/jquery as suggested by Nikhil

1
  • Hi.. I want to redirect the user to the page which resides in the non root site collection. How to do that? @spevilgenius
    – users1100
    Commented Oct 7, 2014 at 12:44
0

Ideally you need to write javascript for the dialog box to open and change the functionality of Save and cancel. Check this out : Newform.aspx in a dialog box

-1

Yes you can customize your "NewForm.aspx" page in SharePoint Designer. You need to write a JavaScript code for this purpose. JavaScript codes are readily available, you just need to search for it on the web. Once you got the JS code, modify it and you are done.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.