开发者

PreSaveAction is not firing

Any idea why the preSaveAction is only redirecting. It should add a record and then take user to the survey's thank you page.

<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.6.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
// old handler:
var oldHandler = function() {
if (!PreSaveItem()) return false;
WebForm_DoPostBackWithOptions(new We开发者_开发问答bForm_PostBackOptions("ctl00_m_g_4bde870c_7fcd_4f61_b446_e287f846faf3_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem", "", true, "", "", false, true));
};
// remove old and add new handler:
var newHandler = function() {
if (!PreSaveItem()) return false;
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00_m_g_4bde870c_7fcd_4f61_b446_e287f846faf3_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem", "", true, "", "", false, true));
window.location.replace("/surveys/Pages/ThankYou.aspx");
return true;
};
$("#ctl00_m_g_4bde870c_7fcd_4f61_b446_e287f846faf3_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem").unbind('click', oldHandler).click(newHandler);
});
</script>


You are missing a '#' in the jquery part of your script. When you are referencing an element by id, you have to put a '#' in front of the id.

$("#ctl00_m_g_f46a290b_d993_4347_a2da_868aff18de82_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem").unbind("click", oldHandler).click(newHandler);

But I doubt the script will run as expected, unless you remove the "<input...>" tag. As for me, neither Chrome nor IE9 will do the job. Only FF6 ignores the tag.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜