尽量避免使用属性disabled
提交按钮点击多次提交,但点击它只是阻止按钮,没有任何反应。尝试添加id
到Html.Begin形式,而是点击它给服务器应用程序错误,如:the parameters dictionary contains a null entry for parameter 'id' of non-nullable type System.Int32
提交表单上的阻止按钮
@using (Html.BeginForm(MVC.Controller.MethodName(), FormMethod.Post, new { id = "submitFormId" }))
<button class="btn btn-w-m btn-primary" type="button" id="submitButtonId" value="AddSmth" onclick="return validateForm(event)">
<i class="fa fa-plus"></i> Add
</button>
和JS:
$("#submitButtonId").attr("disabled",true);
$('#submitFormId').submit();
http://stackoverflow.com/questions/926816/how-to-prevent-从提交的多次客户端 –
@mplungjan不适合我 – Vitaliy