zoukankan      html  css  js  c++  java
  • 避免表单多次提交

    1:提交后将Submit按钮设为Disable

    <div id="SpecialBrokerageEdit">
        @using (Html.BeginForm("AddSpecialBrokerage", "BrokerageStandard", FormMethod.Post, new { id = "frmSpecialBrokerageEdit" }))
        {
            @Html.HiddenFor(m => m.SpBrokerageStdId)
            @Html.HiddenFor(m => m.SpecialBrokerageId)
                 <table>
                <tr>
                    <td>@Html.LabelFor(m => m.SpSiteId)</td>
                    <td>
                        @Html.TextBoxFor(m => m.SpSiteId)
                        @Html.ValidationMessageFor(m => m.SpSiteId)
                    </td>
                </tr>
                  <tr>
                    <td>
                        <label>佣金分配:</label>
                    </td>               
                </tr>
                <tr>
                    <td>@Html.LabelFor(m => m.SpMediaPercent)</td>
                    <td>
                        @Html.TextBoxFor(m => m.SpMediaPercent)<label  name="SpPercentTypeLog">元</label>
                        @Html.ValidationMessageFor(m => m.SpMediaPercent)
                    </td>
                </tr>
                <tr>
                    <td>@Html.LabelFor(m => m.SpPlatformPercent)</td>
                    <td>
                        @Html.TextBoxFor(m => m.SpPlatformPercent)<label name="SpPercentTypeLog">元</label>
                        @Html.ValidationMessageFor(m => m.SpPlatformPercent)
                    </td>
                </tr>
            </table>
            <div class="buttoncontainer">
                <input style="50px;height:30px;" type="submit" value="确定" id="btnspecialBrokerageSave" />
                <input style="50px;height:30px;" type="button" value="取消" id="btnspecialBrokerageCancel" />
            </div>
        }
    </div>
    
        var options = {
            beforeSubmit: function () {
                var itemBtn = $("#btnspecialBrokerageSave");
                itemBtn.prop("disabled", "disabled");
                setTimeout(function () {
                    itemBtn.removeAttr("disabled");
                }, 2000);
                return false;
            },
            success: function (data) {
                if (data.Status == 1) {
                    info.btnSearchSpecialBrokerage.click();
                    infoSpecial.btnspecialBrokerageCancel.click();
                } else {
                    alert(data.Message);
                }
            }
        };
        $('#frmSpecialBrokerageEdit').ajaxForm(options);
    
  • 相关阅读:
    Python的容器类型的遍历汇总
    python学习0313作业
    Python的字符编码
    hadoop-sqoop学习笔记
    eclipse Git & maven 安装
    使用mongoperf评估磁盘随机IO性能
    限制mongodb内存占用过高方法
    rabbitmq集群安装
    Perfmon
    mongodb所在目录空间不足解决方法
  • 原文地址:https://www.cnblogs.com/Mylimo/p/3770883.html
Copyright © 2011-2022 走看看