Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

[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

share|improve this question
    
Ideally you need to write javascript for the dialog box to open and change the functionality of Save and cancel. Check this out : sharepoint.stackexchange.com/questions/20473/… . –  Nikhil Oct 5 '11 at 10:55
add comment

4 Answers

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

share|improve this answer
add comment

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

share|improve this answer
add comment

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.

share|improve this answer
add comment

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/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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