如何阻止用户双击我的注册表单上的提交按钮,这是一个ajax局部视图?
我很遗憾地问,因为这已经被问过了.我现在找不到一个明确的工作答案.禁用该按钮会阻止提交.使用var javascript clickcount警报return_false不会重置.
环境:asp.net mvc3
视图:
表单显示onload:@RenderPage(“_ SignupForm.cshtml”)
提交使用:
@using (Ajax.BeginForm("Index","Signup",null,new AjaxOptions { UpdateTargetId = "signupForm",InsertionMode = InsertionMode.Replace,HttpMethod = "POST",LoadingElementId="progress" } ))@H_502_12@提交控制权:< input type =“submit”value =“注册”/>
SignupController:
public ActionResult Index() { return View(); } [HttpPost] public ActionResult Index(SignupModel formvalues) { Thread.Sleep(5000); string errors = ""; if (TryValidateModel(formvalues)) { errors = SignupAPI.Signup(formvalues); //includes custom validation } if (ModelState.IsValid == false || string.IsNullOrEmpty(errors) == false) { ViewBag.Errors = errors; return PartialView("_SignupForm",formvalues); } else return Redirect(string.Concat("http://localhost/welcome")); }@H_502_12@