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

Possible Duplicate:
PreSaveAction is not firing

This code only adds item but not doing the redirecting....

<script type="text/javascript">
$(document).ready(function() {

    var button = $("input[id$=ctl00$m$g_f46a290b_d993_4347_a2da_868aff18de82$ctl00$toolBarTbltop$RightRptControls$ctl01$ctl00$diidIOSaveItem]");
    // change redirection behavior
        button.click(function() {
            var elementName = $(this).attr("Finish");
            var aspForm = $("form[name=aspnetForm]");
            var oldPostbackUrl = aspForm.get(0).action;
            var currentSourceValue = GetUrlKeyValue("Source", true, oldPostbackUrl);
            var newPostbackUrl = oldPostbackUrl.replace(currentSourceValue, "/srv/Pages/ThankYou.html");

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

share|improve this question

marked as duplicate by PirateEric, Jesus Shelby, Vedran Rasol, Alex Angas Sep 13 '11 at 4:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

@Nancy, If you have made updates, please edit your original post instead of posting a new question. Thx. –  Jesus Shelby Sep 2 '11 at 16:16

1 Answer 1

The simple solution is to craft a hyperlink to the NewForm page that includes a ?Source querystring parameter to the page you want to end up.

share|improve this answer

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