Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Javascript to redirect to new page on click of save button in custom list

$
0
0

Hi ,

I have a custom list . I have few controls which are mandatory and on clicking on save, I want to save the data in custom list, but redirect the page to a custom page.

I have tried the below in Newform.aspx. The page is getting re-directed , but the data is not saved and I get an error message as - You must specify a value for the required field. But I have filled all the fields.

       var button = $("input[id$=SaveItem]");
        button.removeAttr("onclick");
        button.click(function() {
            var elementName = $(this).attr("name");
            var aspForm = $("form[name=aspnetForm]");
                        var newPostbackUrl =  "/s/customsite/SitePages/Thank-you.aspx";

            if (!PreSaveItem()) return false;
            WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(elementName, "", true, "", newPostbackUrl, false, true));
        });
 

How to fix this?

Thanks


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>