在表单按钮提交上弹出插件“你确定”

问题描述

我在我的一个页面中使用 JS/JQuery "are-you-sure" plugin 来要求用户确认他是否真的想要关闭文档并丢失他在表单中填写的数据。

它工作正常,除非在单击提交表单的按钮时弹出窗口仍在弹出(它不应该)。我在网上搜索,但找不到解决此问题的答案。这是我的代码

<script>
        // this part works fine
        $(function () {
            $('form').areYouSure();
        });

        // I found that this code Could prevent the popup to rise on submit but it didn't work
        $('form').submit(function () {
            $('form').removeClass(settings.dirtyClass);
        });
</script>

这是我的表格的部分副本:

    <form id="form1" runat="server" autocomplete="on">
        <asp:ScriptManager ID="scrptMgr" runat="server" />
        <div class="PAFContainer clearfix" style="padding:10px;width:90%;max-width:700px;background-color:#e9eeff;">
            <div class="PAFFieldContainer">
                <div class="PAFLabel"><h2 class="PAFLabel">Email Address*</h2></div>
                <div class="PAFInput"><input class="rounded" runat="server" type="text" id="email" name="email" maxlength="100" onblur="trimMe('email');" /></div>
            </div>
       </div>
       <div class="PAFContainer" style="width:100%;max-width:800px;text-align:right;border:0px;">
            <div class="PAFFieldContainer">
            <br />
            <telerik:RadImageButton ID="btnWelcomeApply" runat="server" AutopostBack="true"
                SingleClick="true"
                OnClientClicking="Checkrequired"
                OnClick="btnWelcomeApply_Click"
                disabledImageUrl="~/custom_images/topics/paf_go_button_280_h.png"
                Image-Url="~/custom_images/topics/paf_go_button_280.png" 
                Image-HoveredUrl="~/custom_images/topics/paf_go_button_280_h.png"
                Sizing="stretch"
                Width="280" Height="57" >
            </telerik:RadImageButton>
            </div>
        </div>
   </form>

知道如何修复它吗?

PS:或者有更好的方法吗?我在 StackOverflow 中发现这个插件是最好的解决方案,这就是我选择它的原因......

非常感谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)