Any idea why the PreSaveAction is not firing. I am trying to take the user to a thankyou page when they complete a survey. I added this js thru SP Designer to NewForm.aspx.


    <script type="text/javascript" src="'/_layouts/jQuery/jquery-1.6.min.js"> </script>
    <script type="text/javascript">
    $(document).ready(function(){
    // old handler:
    var buttonID = document.getElementById("ctl00_m_g_f46a290b_d993_4347_a2da_868aff18de82_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem");
    var oldHandler = function() {
    if (!PreSaveItem()) return false;
    WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00_m_g_f46a290b_d993_4347_a2da_868aff18de82_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem", "", true, "", "", false, true));
    };
    // remove old and add new handler:
    var newHandler = function() {
    if (!PreSaveItem()) return false;
    
    <input type="button" value="Finish" name="Submit" onclick="if (!PreSaveItem()) return false;{ddwrt:GenFireServerEvent('__commit;__redirect={/thankyou.aspx}');}" />
    
    //WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00_m_g_f46a290b_d993_4347_a2da_868aff18de82_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem", "", true, "", "", false, true));
    //window.location.replace("/ThankYou.aspx");
    return true;
    };
    $("ctl00_m_g_f46a290b_d993_4347_a2da_868aff18de82_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem").unbind("click", oldHandler).click(newHandler);
    });
    </script>