Question

I need the Save button on a list's NewForm.aspx page to redirect to a "Thank You" page. I need to do this without creating a custom form or a new page (though I'm willing and able to create one for testing), as a consultant customized the form behavior on the default page using JavaScript (I think), and I have no idea how to get that transferred to a new page or custom form. Further, there are a number of content types we're working with, and creating a custom form seems to be limited to one content type.

The consultant is no longer with us and is unavailable for additional help. I have very little experience with JavaScript and am not at all comfortable with it, though I could probably read and follow the gist of what a script is doing.

The consultant left me with instructions on how to create new buttons within a CEWP, which I am able to do successfully, but I am unable to find a way to hide the default buttons on the ListFormWebPart.

I've read numerous articles saying to specify the Source query string, but I can't find a step-by-step guide on how to do that. There are also numerous JQuery/JavaScript options out there, but again, none of them are step-by-step enough for me to follow along.

TL;DR: How do I edit the Save button on a form to redirect to a Thank You page without creating a custom form?

Edit: I should mention if this is not possible, I may just have to go back to the client and tell them as much. I don't want to throw anyone under the bus, but the consultant knew my technical limitations (I just recently took on this job, and part of her job was to train me) and I could tell the client as much.

Was it helpful?

Solution

  1. Click add a new item in your list. Now the NewForm.aspx Form opens up.

  2. Edit this page and add a Script Editor or CEWP.

  3. Now use the Presave function (code written under this function executes when the 'save' button is clicked). You can add some code to the script editor or CEWP.

Note: You need to add reference for Jquery in the code, on the top.

See code below for reference:

function PreSaveAction() {    
    var url = "Paste Thank you Page Url here";
    window.location.href = url;    
}

OTHER TIPS

Yes @rolemartyr-x from a SharePoint developer's view I would say it is useful collecting user's data and using the same data over the Redirect page. But in this case this will suffice your current need:

--> Whenever you will open a new form(for creating a new item) in a SharePoint list, you will find a similar URL in the browser's window :

https://xyz.sharepoint.com/Lists/LIST%20A/NewForm.aspx?Source=https%3A%2F%2Fxyz%2Esharepoint%2Ecom%2FLists%2FLIST%2520A%2FAllItems%2Easpx&RootFolder=

--> We are supposed to change the source URL on this page(in the bold).

For Example:

https://xyz.sharepoint.com/Lists/LIST%20A/NewForm.aspx?Source= Paste Your Redirect Page/Thank you page URL here

--> This will save the item as well. But the catch is you will have to add a link somewhere to the Newform.aspx page of your list, which should be appended with the URl as above. Once the user clicks this link, he/she will be directed on the NewForm.aspx. For example you can add this link on your homepage(on the top navigation). If you need more help let me know!

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top