儘量避免使用屬性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